learning F#, it seems pretty cool, favourite functional language so far.
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

123456789101112131415161718
  1. open System
  2. let r = Random()
  3. let secretNum = r.Next(1, 100)
  4. printfn "Secret Num is between 1-100"
  5. let mutable found = false
  6. while (not found) do
  7. printfn "Enter a guess:"
  8. let guess_s = Console.ReadLine()
  9. let guess = Convert.ToInt32(guess_s)
  10. match guess with
  11. | guess when secretNum = guess ->
  12. printfn "You guessed correctly!"
  13. found <- true
  14. | guess when guess > secretNum ->
  15. printfn "Lower"
  16. | _ ->
  17. printfn "Higher"