
F# if/then statement consists of a Boolean expression followed by one or more statements.
Syntax of F# if/then statement
The if/then construct in F# has the following syntax −
(* simple if *) if expr then expr
Flow diagram

Example
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
When you compile and execute the program, it yields the following output −
a is less than 20 Value of a is: 10
Next Topic – Click Here
Pingback: F# - Decision-Making - Adglob Infosystem Pvt Ltd
Pingback: F# - Nested if Statement - Adglob Infosystem Pvt Ltd