What does the in keyword in F # do?

I am reading Expert F # from Apress and there is a fragment that I really donโ€™t understand:

let powerOfFour n = let nSquared = n * n in nSquared * nSquared Console.WriteLine(powerOfFour 2) 

What are the keywords in, and allows me to call a method inside the method itself?

+7
f #
source share
1 answer

in is the moral equivalent of a newline after a let . This is the same as

 let nSquared = n * n nSquared * nSquared 

except all in one line. You can read a few more words here:

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

which displays many of the โ€œdetailedโ€ keywords that you donโ€™t need when you just let the bumps do the work.

+10
source share

All Articles