F# uses relatively little ceremony to express common programming tasks. Functions, values, and types can focus on the problem being modeled without routinely requiring type annotations or full classes. Compact syntax works alongside a type-safe compiler; it does not mean giving up compiler checks. section 1.1
A function with little ceremony
let addTenThenDouble theNumber = let addedTen = theNumber + 10 let answer = addedTen * 2 answer The final expression supplies the result. A value uses the same `let` pattern: `let mySimpleValue = 99`. section 3.1.1
Listing 3.2 A verbose version of F# syntax basics
let addTenThenDouble (theNumber : int) : int = #1
{ #2
let addedTen : int = theNumber + 10; #3
let answer : int = addedTen * 2;
printfn $"({theNumber} + 10) * 2 is {answer}";
let website : System.Uri = new System.Uri ("https://fsharp.org"); #4
return answer; #5
}
Compare the deliberately verbose version with the compact function. It makes visible the annotations, braces, semicolons, and explicit return that the compact version does not need. section 3.1.1
Small defaults also reduce repetition: declarations are public by default, and `not` provides a readable alternative to a negation symbol. Less boilerplate leaves more room for domain logic. Compiler checks still matter: adding a field to an F# type requires its value to be supplied wherever that type is initialized. section 3.1.1 section 2.1.4
