“阿米戈,你可能不会相信,在 Pascal 语言中也有 For 循环。此结构几乎存在于每一种编程语言中。但是在 Pascal 中,它要清晰得多。请看:”
Pascal 语言
For i := 1 to 10 do
Begin
Writeln(i);
End;
Java 语言
for (int i = 1; i <= 10; i++)
{
System.out.println(i);
}
Pascal 语言
For i := 1 to 10 do step 2
Begin
Writeln(i);
End;
Java 语言
for (int i = 1; i <= 10; i = i + 2)
{
System.out.println(i);
}
Pascal 语言
For i := 10 downto 0 do step 2
Begin
Writeln(i);
End;
Java 语言
for (int i = 10; i >= 0; i = i - 2)
{
System.out.println(i);
}
GO TO FULL VERSION