Rust TutorialLesson 4Free preview
Rust Syntax
This lesson is part of Rust · All levels
Summary
This lesson reviews the basic syntax rules for writing code in Rust. The reader is taught how to arrange function blocks, use curly braces, and end a sentence with a semicolon. Understanding this basic structure is essential to writing code that passes compilation.
Key points
- Function defined using the keyword 'fn'
- The block code is flanked by curly braces '{' and '}'
- The statement must be completed with a semicolon (;)
- The last expression in a block without semicolon marks will be the return value
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.