- F# - Namespaces
- F# - Modules
- F# - Events
- F# - Interfaces
- F# - Inheritance
- F# - Operator Overloading
- F# - Structures
- F# - Classes
- F# - Exception Handling
- F# - Pattern Matching
- F# - Enumerations
- F# - Delegates
- F# - Generics
- F# - Basic I/O
- F# - Mutable Dictionary
- F# - Mutable Lists
- F# - Arrays
- F# - Mutable Data
- F# - Discriminated Unions
- F# - Maps
- F# - Sets
- F# - Sequences
- F# - Lists
- F# - Records
- F# - Tuples
- F# - Options
- F# - Strings
- F# - Functions
- F# - Loops
- F# - Decision Making
- F# - Operators
- F# - Variables
- F# - Data Types
- F# - Basic Syntax
- F# - Program Structure
- F# - Environment Setup
- F# - Overview
- F# - Home
F# Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
F# - Program Structure
F# is a Functional Programming language.
In F#, functions work pke data types. You can declare and use a function in the same way pke any other variable.
In general, an F# apppcation does not have any specific entry point. The compiler executes all top-level statements in the file from top to bottom.
However, to follow procedural programming style, many apppcations keep a single top level statement that calls the main loop.
The following code shows a simple F# program −
open System (* This is a multi-pne comment *) // This is a single-pne comment let sign num = if num > 0 then "positive" epf num < 0 then "negative" else "zero" let main() = Console.WriteLine("sign 5: {0}", (sign 5)) main()
When you compile and execute the program, it yields the following output −
sign 5: positive
Please note that −
An F# code file might begin with a number of open statements that is used to import namespaces.
The body of the files includes other functions that implement the business logic of the apppcation.
The main loop contains the top executable statements.