Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

F#'s underscore: why not just create a variable name?

Tags:

f#

Reading about F# today and I'm not clear on one thing:

From: http://msdn.microsoft.com/en-us/library/dd233200.aspx

you need only one element of the tuple, the wildcard character (the underscore) can be used to avoid creating a new name for a variable that you do not need

let (a, _) = (1, 2)

I can't think of a time that I've been in this situation. Why would you avoid creating a variable name?

like image 457
jcollum Avatar asked Dec 31 '12 19:12

jcollum


People also ask

Facebook itu apa sih?

Facebook adalah media sosial dan layanan jejaring sosial online Amerika yang dimiliki oleh Meta Platforms.


1 Answers

Because you don't need the value. I use this often. It documents the fact that a value is unused and saves naming variables unused, dummy, etc. Great feature if you ask me.

like image 88
Daniel Avatar answered Oct 02 '22 17:10

Daniel