Skip to content

Instantly share code, notes, and snippets.

@HerbM
Created March 16, 2017 11:59
Show Gist options
  • Save HerbM/5abe48e9b55a39086c1923984fcce810 to your computer and use it in GitHub Desktop.
Save HerbM/5abe48e9b55a39086c1923984fcce810 to your computer and use it in GitHub Desktop.
open System
open System.Text.RegularExpressions
exception QuitProgram
(* // defining this function causes the initial "> " to not be displayed first
let ProcessInput =
let input = System.Console.ReadLine()
try
let f = System.Single.Parse(input)
sprintf "%f" f
with _ -> input
*)
[<EntryPoint>]
let main argv = // printfn "%A" argv
try
while true do
System.Console.Write("> ")
let input = System.Console.ReadLine()
if Regex.Match(input, "^\s*q(uit)?|(exit)\s*$").Success then raise QuitProgram
System.Console.WriteLine(input)
0
with _ -> 0 // return an integer exit code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment