F# Pages

Dot Net Perls has example pages for many languages, with explanations and code side by side (for easy understanding).
Dict. Create a dictionary with dict. Use Item, Keys and TryGetValue to access the dictionary.F# dict: Dictionary Examples, Item and Keys
Arrays. Instantiate arrays of strings and ints. Use ranges, accesses elements and stores values in arrays.F# Array Examples
Downcast, upcast. Cast objects in the type hierarchy with the upcast and downcast keywords.F# Downcast and upcast Example
Failwith. Handle exceptions and use the failwith and raise operators. Use failwith inside match.F# Failwith: Exception Handling
Files. Use System.IO and StreamReader to read lines of text files. Specify the use, and open, keywords.F# Files: open System.IO, use StreamReader
For, while. Loop over ranges and collections with the for-to, for-in and while loops.F# For and While Loop Examples: For To, For In
Fun, lambdas. Describe higher-order procedures and the fun keyword. Specify lambda expressions.F# Fun Keyword: Lambda Expressions, Functions
If, elif. Add branches with the if, elif and else keywords. Test conditions in programs.F# If, elif and else Examples
Keywords. Review keywords in the F# language. Browse examples that use these keywords.F# Keywords
Let. Understand the let, let mutable and lightweight syntax. See functions, variables and temporary variables.F# Let Keyword: let mutable, Errors
List. Store collections of strings and ints with lists. Use a for-loop upon a list.F# List Examples, String Lists
Match. Test data, and direct the flow of control, with the match keyword. Match inside a method.F# Match Keyword
Math. Perform computations on numbers with math operators. Call pown, abs, floor and ceil.F# Math Operators: abs, floor and ceil
Option. Learn about option types. Access the IsNone, IsSome and Value properties on an option.F# Option int Example: IsNone, IsSome and Value
Printfn. Write values to the screen with the printfn and printf methods. See format codes for strings and ints.F# Printfn Examples: printf, Formats
Records. Create records with named fields, using the type and with keywords.F# Record Examples: Type, With Keywords
Remove duplicates. Invoke Seq.distinct to remove duplicates from a list. Convert from the seq back into a list or array.F# Remove Duplicates From List (Seq.distinct)
Seq. Use the Seq module and evaluate sequences with methods like sum and where.F# Seq Examples: Seq.sum, Seq.where
Sort. Sort a list with the List.sort function. Use sortBy with a fun to customize the sort order.F# Sort List Examples: sortBy, Lambdas
Strings. Understand strings and string methods. Use .NET Framework methods in F# constructs.F# String Examples:
Tuple. Learn the syntax of tuples. Create tuples, unpack tuples and return tuples from methods.F# Tuple Examples
Type. Use types with members and mutable fields. Create instances of the types.F# Type Example: member, get and set
© 2007-2019 Sam Allen. Every person is special and unique. Send bug reports to
Dot Net Perls