Created
March 28, 2018 12:29
-
-
Save shindig7/ec54db0c9fceda4ed9f1624ef71f4234 to your computer and use it in GitHub Desktop.
F# Test created by shindig_ - https://repl.it/@shindig_/F-Test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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