After trying this simple console input with 5, the result is shown as 53
printfn "Enter no. of blocks: "
let nBlock = System.Console.Read()
printfn "entered value is %O" nBlock
Tried it on the interactive, still getting wrong results. Any solutions please?
You should try something like:
Explanation:
you code only reads one character – as Lee mentioned
with this you will read a line (ending after you press return) and parse that string into a int.
Remark: maybe you will want to check for a number, you can do this with TryParse:
Of course you will have to check for the error case (-1) or change it into a option or something.