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
open System | |
printf "Type in a number: " | |
let number = int32(Console.ReadLine()) | |
let rec factorial n = if n = 1 then 1 else n * factorial(n-1) | |
printfn "The factorial of %d is %d" number (factorial number) | |
Console.ReadLine() |> ignore |
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
open System | |
let rec PrintReverse () = | |
let input = Console.ReadLine() | |
if input <> "END" then | |
PrintReverse() |> ignore | |
printfn "-> %s" input | |
PrintReverse() |
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
open System | |
[<EntryPoint>] | |
let main(args) = | |
let numArgs = Array.map (fun arg -> int32(arg)) args | |
printfn "Read %d numbers" args.Length | |
printfn "Min value %d" (Array.min numArgs) | |
printfn "Max value %d" (Array.max numArgs) | |
Console.ReadLine() |> ignore | |
0 |