That’s because the
format parameter is not actually a
TextWriterFormat<'T> and the F# compiler converts the string format into that type. But it doesn’t work on
string variables, because the compiler can’t convert the
TextWriterFormat<'T> at runtime.
If you want to print the content of the variable, you shouldn’t even try to use
printfn this way, because the variable could contain format specifications.
You can either use the
printfn "%s" test
Or use the .Net
Don’t forget to add
open System at the top of the file if you want to use the