Skip to content

Instantly share code, notes, and snippets.

@shindig7
Created March 28, 2018 12:29
Show Gist options
  • Save shindig7/ec54db0c9fceda4ed9f1624ef71f4234 to your computer and use it in GitHub Desktop.
Save shindig7/ec54db0c9fceda4ed9f1624ef71f4234 to your computer and use it in GitHub Desktop.
F# Test created by shindig_ - https://repl.it/@shindig_/F-Test
printf "Guess the number!: "
let mutable input = System.Console.ReadLine() |> System.Int32.Parse
let secret = System.Random().Next(1,101)
while input <> secret do
let diff = input - secret
if diff > 0 then
printfn "Try again! The secret number is LOWER than %d" input
printf "Next guess?: "
input <- System.Console.ReadLine() |> System.Int32.Parse
else
printfn "Try again! The secret number is HIGHER than %d" input
printf "Next guess?: "
input <- System.Console.ReadLine() |> System.Int32.Parse
printfn "You guessed it! The secret number was %d" secret
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment