RustArena

Step 2 of 6

Printing your own text

A piece of text in double quotes, like "I like pizza", is a string literal. println! prints it exactly as written: every letter, space and capital. The quotes themselves aren't printed; they only mark where the text starts and ends.

fn main() {
    println!("Rust 1.0 came out in 2015");
    println!("   spaces   are   kept");
}
Rust 1.0 came out in 2015
   spaces   are   kept

Why exact output matters

The tests on this site compare your program's output with the expected output character by character (ignoring only spaces at the ends of lines and blank lines at the very end). Real programs work the same way: another program reading your output, or a test at work, won't guess what you meant. I am learning rust is not the same as I am learning Rust.

Your task

Make the program print exactly:

I am learning Rust

Challenge 2

Make the program print exactly Round 1 starts NOW. Watch the capital letters.

Challenge 3

The starter code prints the right words but not the exact text. Fix the string so the program prints exactly I like Rust programming. with a capital I and R, one space between words and a period at the end.

Previous: Your first program Next: Several lines, and print! versus println!