Professional Documents
Culture Documents
20 - PDFsam - Beginning Rust - From Novice To Professional (PDFDrive)
20 - PDFsam - Beginning Rust - From Novice To Professional (PDFDrive)
you get a compilation error too, as the placeholders inside the first argument are more
numerous than the arguments after the first argument; that is, there is a placeholder that
doesn't have any corresponding argument.
Instead, the corresponding statements in the C language do not raise compilation
errors, but instead cause the compiled program to crash or misbehave.
First line
Second line
Third line
The sequence of characters \n, where n stands for “new line”, is transformed by
the compiler into the character sequence that represents the line terminator for the
currently used operating system.
Given that it is very common to go to a new line only once for every printing
statement, and just at the end of the statement, another macro, "println", has been
added to the Rust standard library. It’s used in this way:
Calling this println macro (whose name is to be read “print line”) is equivalent to
calling print with the same arguments, and then outputting a line terminator.