Advertisement
ptrelford

Magic 8-Ball

Aug 10th, 2014
325
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
F# 0.58 KB | None | 0 0
  1. let answers =[
  2.    "Go for it!"
  3.    "No way Jose!"
  4.    "I'm not sure. Ask me again."
  5.    "Fear of the unknown is what imprisons us."
  6.    "It would be madness to do that!"
  7.    "Only you can save mankind!"
  8.    "Makes no difference to me, do or don't - whatever."
  9.    "Yes, I think on balance that is the right choice"
  10.    ]
  11.  
  12. printfn "Welcome to Magic 8-Ball."
  13.  
  14. printfn "Ask me for advice and then press enter to shake me"
  15. System.Console.ReadLine()
  16.  
  17. for i = 1 to 4 do printfn "Shaking..."
  18.  
  19. let rand = System.Random()
  20. let choice = rand.Next(answers.Length)
  21.  
  22. printfn "%s" (answers.[choice])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement