Skip to content

Instantly share code, notes, and snippets.

@craigrbruce
Created October 26, 2015 09:56
Show Gist options
  • Save craigrbruce/cc388a62f4344605ccfa to your computer and use it in GitHub Desktop.
Save craigrbruce/cc388a62f4344605ccfa to your computer and use it in GitHub Desktop.
Module 3 Assignment
let calculateRatio x = x * goldenRatio
let getValue (index: int32) =
Console.WriteLine("Enter value " + index.ToString());
Console.ReadLine()
let getValues count =
let result =
[ for i in 1 .. count -> float(getValue(i))]
result
[<EntryPoint>]
let main argv =
Console.Write("How many values would you like to input? ")
let valueCount = Int32.Parse(Console.ReadLine())
let values = getValues valueCount
let result =
[for index in 0 .. (valueCount-1) -> (values.[index], calculateRatio(float values.[index]))]
result |> List.iter (fun r -> Console.WriteLine(r))
0 // return an integer exit code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment