



Format specifiers for printfįormat specifications for printf formats are strings with % markers that indicate format. The correct type to match the format specifiers used. Technically speaking, when using printf and other related functions, a special rule in the F# compilerĬhecks the string literal passed as the format string, ensuring the subsequent arguments applied are of Stdin(3,25): error FS0001: The type 'string' does not match the type 'int' Gives the output sprintf "Hello %s" (2+2) Checking of printf-format stringsĪ compile-time error will be reported if a printf formatting function is used with an argument that doesn't match the printf format That occur implicitly in debugging, logging, and other tooling. Plain text formatting is also observable through any calls to x.ToString() on F# union and record values, including those It's also activated when formatting the output of values in F# interactive, where the output includes extra information and is additionally customizable. Structured plain text formatting is activated when you use the %A format in printf formatting strings. > printfn "Hello %s, %d + %d is %d" "world" 2 2 (2+2) į# also allows structured values to be formatted as plain text.įor example, consider the following example that formats the output as a matrix-like display of tuples. F# supports type-checked formatting of plain text using printf, printfn, sprintf, and related functions.
