CodeGym /Java Course /Java の構文 /惑星パスカルからの条件

惑星パスカルからの条件

Java の構文
レベル 4 , レッスン 5
使用可能

「こんにちは、アミーゴ。私たちの地球では、より高度な Pascal を使用しています。Pascal では次のようになります。」

パスカル
If a < b Then
    WriteLn ('a is less than b');
ジャワ
if (a < b)
    System.out.println("a is less than b");
パスカル
If a < b Then
    WriteLn('a is less than b')
Else
    WriteLn('a is greater than b');
ジャワ
if (a < b)
    System.out.println("a is less than b");
else
    System.out.println("a is greater than b");
パスカル
If a < b Then
    Begin
        WriteLn('a is less than b');
        WriteLn('a is less than b');
    End
Else
    Begin
        WriteLn('a is greater than b');
        WriteLn('a is greater than b');
    End;
ジャワ
if (a < b)
{
    System.out.println("a is less than b");
    System.out.println("a is less than b");
}
else
{
    System.out.println("a is greater than b");
    System.out.println("a is greater than b");
}

パスカル
If a < b And a < c Then
    WriteLn('a is the minimum of a, b, c');
ジャワ
if (a < b && a < c)
    System.out.println("a is the minimum of a, b, c");
パスカル
If a < b Or a < c Then
    WriteLn('a is either less than b, or less than c');
ジャワ
if (a < b || a < c)
    System.out.println("a is either less than b, or less than c");
パスカル
If Not (a < b) Then
    WriteLn('b is less than or equal to a')
Else
    WriteLn('b is greater than a');
ジャワ
if ( !(a < b) )
    System.out.println("b is less than or equal to a");
else
    System.out.println("b is greater than a");
パスカル
If a < b Then
    Begin
       If a < c Then
            WriteLn('a is the minimum')
        Else
            WriteLn('c is the minimum');
    End
Else
    Begin
        If b < c Then
            WriteLn('b is the minimum')
        Else
            WriteLn('c is the minimum');
    End;
ジャワ
if (a < b)
{
    if (a < c)
        System.out.println("a is the minimum");
    else
        System.out.println("c is the minimum");
}
else
{
    if (b < c)
        System.out.println("b is the minimum");
    else
        System.out.println("c is the minimum");
}
パスカル
If a <= b And a <= c Then
    WriteLn('a is the minimum')
Else If b <= a And b <= c Then
    WriteLn('b is the minimum')
Else If c <= a And c <= b Then
    WriteLn('c is the minimum');
ジャワ
if (a <= b && a <= c)
    System.out.println("a is the minimum");
else   if (b <= a && b <= c)
    System.out.println("b is the minimum");
else   if (c <= a && c <= b)
    System.out.println("c is the minimum");
コメント
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION