Fsharp-if-statement
提供:Dev Guides
F#-if/thenステートメント
if/thenステートメントは、ブール式とそれに続く1つ以上のステートメントで構成されます。
構文
F#のif/thenコンストラクトの構文は次のとおりです-
( *simple if* )
if expr then
expr
流れ図
例
let a : int32 = 10
( *check the boolean condition using if statement* )
if (a < 20) then
printfn "a is less than 20\n"
printfn "Value of a is: %d" a
あなたがプログラムをコンパイルして実行すると、次の出力が得られます-
a is less than 20
Value of a is: 10