typeover
rust curriculum

Curriculum Foundations Hello and printing exercise 9 · freeform

Hello and printing

About this theme

Rust prints with a macro, not a function. println! (note the !) writes to stdout with a trailing newline; print! is the no-newline variant. Format placeholders use {} instead of TypeScript's template-literal ${...}. Macros, format strings, and the no-newline-by-default print! are the three reflex shifts here. Planned exercises: 1. choose fn main(). 2. choose println!. 3. recognise macro calls by !. 4. fill the println! macro name. 5. fill a {} format placeholder. 6. write one print line. 7. write a formatted greeting. 8. translate a complete hello program. 9. write a tiny program that prints two lines.