Skip to content

Latest commit

 

History

History
53 lines (39 loc) · 746 Bytes

printing_special_strings.md

File metadata and controls

53 lines (39 loc) · 746 Bytes

Printing Special Strings

Sometimes, we want to print symbol ". In this case, we have to type \ before ". For example:

fn main() {
    println!("\"");
}

Output:

"

There are other special symbols such as {, } and \ that require special forms to print them.

fn main() {
    println!("{{");
    println!("}}");
    println!("\\");
}

Output:

{
}
\

These symbols may look like this when they are combined with other texts:

fn main() {
    println!("{{}} is a pair of \"braces\". \\(o.o)/");
}

Output:

{} is a pair of "braces". \(o.o)/

➡️ Next: Printing Numbers

📘 Back: Table of contents