Printf vs. Format?

Not quite: Printf is an output library similar in scope to the IO of the standard C library, its main feature is the support for “formatting strings” which contain placeholders which can be replaced by the textual representation of various arguments. Format, on the other hand, is a pretty-printing library: it will introduce line breaks and indentation to make sure that your output looks “nice” (the exact line breaks and indentation introduced depends on the hints specified by using “boxes”). In other words, one can easily use Format in place of Printf (simply by not introducing any boxing annotations), but not the other way around.

To learn more about Format:

May also be of interest:

Cheers,
Nicolas

7 Likes