CodeGym /Java 课程 /Java 语法 /Pascal 语言中的 for 循环

Pascal 语言中的 for 循环

Java 语法
第 4 级 , 课程 12
可用

“阿米戈,你可能不会相信,在 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);
}
评论 (16)
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION
Anonymous #11297435 级别 7,Haikou,China
9 三月 2023
冒个泡
Li Jack 级别 16,Taiwan, Province of China
31 八月 2022
水我暗物质
Anonymous #11022089 级别 7,Hefei,China
9 九月 2022
对头
叶葳叶 级别 13,旧金山,中国
30 七月 2022
Pascal again😅
null 级别 12
27 一月 2022
maybe there are someones already learned about pascal ?
kqhasaki 级别 23,Daxi,Taiwan, Province of China
30 七月 2021
Is it necessary to talk about Pascal this much?
Anonymous #10795181 级别 11,Hefei,China
25 八月 2021
I choose to ignore
David L 级别 13,newyork,United States
19 十一月 2021
XD That's what I'm thinking Lol
HXS 级别 8,圣地亚哥,瑞典
29 七月 2022
You will find some logical words that are clearer in Pascal than in Java, such as "Do", "Begin"...
tanzhong tan 级别 20
17 五月 2021
i dont know why always talk about Pascal language
Henry Lee 级别 6,Tokyo,Japan
4 九月 2023
for comparison
Sun 级别 5,China
19 四月 2021
😅
Amigo 级别 20,Beijing,China
12 三月 2021
Fantasitic!
Kolania 级别 20,Baotou,China
12 十月 2020
😅
邵 张 级别 8,Shanghai
21 五月 2020
盘它