i started today learning delphi. i m wondering if there is a way to make a delphi code like mine on java using the for each with array of objects. 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.
Originally Answered: What are the differences between Delphi and Pascal ? That's pretty simple: Pascal is the language, and Delphi is a product line that implements that language. Technically Delphi is a version of Object Pascal, just like Freepascal.
You can use a for..in
loop, like so
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With