What does the 'in' keyword do in F#?
I'm reading the book Expert F# from Apress and there is a snippet there that I don't truly understand:
let powerOfFour n =
let nSquared = n * n in 开发者_开发技巧nSquared * nSquared
Console.WriteLine(powerOfFour 2)
What is the 'in' keywords doing here, and does it allow me to call a method inside of the method itself?
in
is the moral equivalent of a newline after a let
. This is the same as
let nSquared = n * n
nSquared * nSquared
except all on one line. You can read some more here:
http://msdn.microsoft.com/en-us/library/dd233199.aspx
which shows off many of the 'verbose' keywords that you don't need when you just let the indentation do the work.
精彩评论