Practice question from FSharp Programming Advanced

What will this code output? A. 15 B. 120 C. 25 D. 5 E. 0

let result =
    [1..5]
    |> List.fold (fun acc x -> acc * x) 1
printfn "%d" result

Answer

B

Explanation

List.fold multiplies all elements, so 11234*5 = 120

More questions from Quick: FSharp Programming Advanced