-1

So, I can't figure out how you make 2 let bindings to the same function result (tuple) in FSharp. For example, if I have a function: Play() whose output is (x,y). And i wanna use x and y in another function. Right now I write:

Let first = fst Play()
Let second = snd Play(). 

But this 2 let bindings are just running function twice. So if it makes sense, how do I make 2 let bindings to a function, that only have to run once? :D Thanks in advance!

AlphaList
  • 237
  • 1
  • 12

1 Answers1

3

Simple:

let first, second = Play()

You could also bind the tuple and later separate it:

let coords = Play()
let x      = fst coords
let y      = snd coords
AMieres
  • 4,944
  • 1
  • 14
  • 19