In F# the following statement will fail with the following errors
let listx2 = [1..10]
|> List.map(fun x -> x * 2)
|> List.iter (fun x -> printf "%d " x)
Block following this 'let' is unfinished. Expect an expression.
Unexpected infix operator in binding. Expected incomplete structured construct at or before this point or other token.
However the following will compile
let listx2 =
[1..10]
|> List.map(fun x -> x * 2)
|> List.iter (fun x -> printf "%d " x)
I also noticed that this compiles but has a warning
let listx2 = [1..10] |>
List.map(fun x -> x * 2) |>
List.iter (fun x -> printf "%d " x)
Possible incorrect indentation: this token is offside of context started at position (10:18). Try indenting this token further or using standard formatting conventions.
What is the difference between the first two statements?