List of articles of F Sharp beginner series
All the codes you write in F Sharp are by default in a MODULE, regardless of the fact that whether you explicitly define a module or not.
Anonymous Module
Anonymous module has the same name as of file name with first letter in upper case.
Let us say,
- you are writing codes inside a file called myfile.fs
- You have explicitly not given a module name.
- Inside the file myfile.fs, you have code as below
4. By default module for above code would be Myfile (same as the file name of the code with first letter in upper case)
Creating Module
Explicitly Module name can be given by using the keyword “Module” .
Now if you want to access variable myNumber in some other module then you will access as below,
Creating Nested Modules
You can create nested modules by using equal to (=) sign with the module name.
In above code we have defined nested modules. You can access myNumber1 variable as below,
In other module you will find inellisense also working,
This was all about Modules in F sharp.
I hope this post was useful. Thanks for reading ![]()
List of articles of F Sharp beginner series
If you find my posts useful you may like to follow me on twitter http://twitter.com/debug_mode or may like Facebook page of my blog http://www.facebook.com/DebugMode.Net If you want to see post on a particular topic please do write on FB page or tweet me about that, I would love to help you.
Follow @debug_mode
Discussion
Trackbacks/Pingbacks
Pingback: Dew Drop – September 29, 2011 | Alvin Ashcraft's Morning Dew - September 29, 2011
Pingback: Monthly Report September 2011: Total Posts 28 « debug mode…… - October 1, 2011