Is there a way in delphi (a Pascal object) to do for everyone, like in java?

I started learning delphi today. I am wondering if there is a way to make delphi code like my in java using an array of arrays for each of them. there is my java code:

class test { public static void main(String[] args){ String[] names={"ali","samad","kamel","djamel","mustapha"}; for(String name:names){ System.out.println("user:"+name); } } } 

thanks.

+5
source share
1 answer

You can use a for..in , for example

 const names : array [0..4] of string = ('ali','samad','kamel','djamel','mustapha'); var s : string; begin try for s in names do Writeln(s); except on E: Exception do Writeln(E.ClassName, ': ', E.Message); end; readln; end. 
+7
source

Source: https://habr.com/ru/post/1212211/


All Articles