Foreach Loop in Lazarus?
Question by Guest | 2014-02-08 at 12:20
Recently, I have often coded using the programming language PHP, at the moment I am working with Lazarus again.
What I am missing from the PHP-world is the foreach-loop with which it is very easy to go through and array element for element.
Lazarus does not seem to know the key word "foreach". Anyway, is there any possibility to run through an array in an easy way? Foreach is so convenient and fast!
Related Topics
PHP: Loop through associative Array with Key and Foreach
Question | 1 Answer
JavaScript: Run through array element by element (foreach)
Tip | 0 Comments
Delphi/Lazarus: Delete selected Items from ListBox using DEL-Key
Tip | 3 Comments
Send Form Input as an Array to PHP Script
Tip | 0 Comments
Delphi/Lazarus: Command Line Parameter Tutorial Part 2: Receiving
Tutorial | 0 Comments
Delphi/Lazarus: How to set up a Link to a Website in an Application
Tutorial | 0 Comments
Repeat Until Loop in JavaScript?
Question | 1 Answer
Important Note
Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.
Participate
Ask your own question or write your own article on askingbox.com. That’s how it’s done.
When I was working with Delphi some years ago, I have also missed the foreach loop. But Lazarus has it, but it is not called FORACH but FOR IN:
In this example, "arr" is a string-array and we are traversing it using the for-in-loop. In each way through, we have the current content from the array in our variable "s".
Using this, working with Lazarus makes even more fun!
2014-02-09 at 12:43