dotnet / docs

This repository contains .NET Documentation.
https://learn.microsoft.com/dotnet
Creative Commons Attribution 4.0 International
4.24k stars 5.88k forks source link

Example not compiling in net5.0 project #26853

Open molotch opened 2 years ago

molotch commented 2 years ago

Just starting out F# and am trying the examples.

This example fails to compile with the error:

error FS0597: Successive arguments should be separated by spaces or tupled, and arguments involving function or method applications should be parenthesized

printfn "%c" str1[1]

If you add a dot (.) between the string literal and the array notation it works as intended, i.e. "str1.[1]". Is there's a difference depending on what F# version you're using?


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

albert-du commented 2 years ago

being able to remove the "." from the indexing syntax is new to F# 6

https://docs.microsoft.com/en-us/dotnet/fsharp/whats-new/fsharp-6#simpler-indexing-syntax-with-expridx

cartermp commented 1 year ago

I think this should just be closed. It's not a doc bug and .NET 5 is out of support.