Skip to content

Instantly share code, notes, and snippets.

@jasondown
Created January 10, 2017 21:34
Show Gist options
  • Save jasondown/aaeb4f719dd790d01ad4818c8f5e38c4 to your computer and use it in GitHub Desktop.
Save jasondown/aaeb4f719dd790d01ad4818c8f5e38c4 to your computer and use it in GitHub Desktop.
let getEquipment equipment =
let rec buildList items listSoFar =
match items with
| [] -> listSoFar
| x::xs -> buildList xs (sprintf "%s %s " listSoFar x)
buildList equipment "Items: "
// Sample usage
["Sword"; "Shield"; "Potatoes"] |> getEquipment |> printfn "%s"
// prints Items: Sword Shield Potatoes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment