53
F# if-then-else expression
F# if-then-else expression tests the condition. It executes if block if condition is true otherwise else block is executed.
F# if-then-else Example
Output:
It is odd number
F# if-then-else Example: with input from user
In this example, we are getting input from the user by using Console.ReadLine() method. It returns string. For numeric value, You have to convert it into int by using Parse.Int32 method.
Output:
Enter a number : 45 It is odd number
Next TopicF# If-elif ladder