Here is the translated code and explanation in F#:
range iterates over elements in a variety of built-in data structures. Let’s see how to use range with some of the data structures we’ve already learned.
Here we use range to sum the numbers in a list. Arrays work like this too.
To run the program, save the code in a .fs file (e.g., RangeOverBuiltInTypes.fsx) and use dotnet run or fsharpi if you are using the F# Interactive.
Or if you prefer to compile and run:
Now that we can run and build basic F# programs, let’s learn more about the language.