How can i return unit
from an expression in f#? For example:
let readInt =
let str = Console.ReadLine()
let (succ, num) = Int32.TryParse(str)
match succ with
| true -> Some(num)
| _ -> None
match readInt with
| Some(v) -> Console.WriteLine(v)
| None -> ignore //i don't want to do anything,
// but i don't know how to ignore this brunch of the expression
The (only possible) unit value in F# is written as
So your code becomes