Skip to content
← All Rust tracks

Ground Rules: Values, Types, Control Flow

Rust

Practise values, primitive types, expressions, branching and loops. Read compiler messages and learn how Rust handles conversions and arithmetic.

This track uses Rust. You can make it your practice mode to browse related content across the site.

23 exercises

1 article

Explore freely. Sign in to keep your progress.

Your learning sequence

  1. 1 Not solved yet. let, immutability by default, and mut Practice · Easy
  2. 2 Not solved yet. Shadowing: rebinding is not mutation Practice · Easy
  3. 3 Not solved yet. Check whether integers fit in a byte Practice · Easy
  4. 4 Not solved yet. Numeric literals: suffixes, underscores, other bases Practice · Easy
  5. 5 Not solved yet. Wrap an eight-bit meter reading Practice · Medium
  6. 6 Not solved yet. checked, wrapping, saturating, overflowing Practice · Medium
  7. 7 Not solved yet. Clock positions with Euclidean remainder Practice · Medium
  8. 8 Not solved yet. Compare floats with an absolute tolerance Practice · Medium
  9. 9 Not solved yet. bool and char Practice · Easy
  10. 10 Not solved yet. Casting with as: truncation, sign reinterpretation, saturation Practice · Medium
  11. 11 Not solved yet. From, Into, TryFrom: conversions that cannot lie Practice · Medium
  12. 12 Not solved yet. Return a grade with an if expression Practice · Easy
  13. 13 Not solved yet. Find the first negative value with an early return Practice · Easy
  14. 14 Not solved yet. Build FizzBuzz strings with an if expression Practice · Easy
  15. 15 Not solved yet. loop, while, for, and break with a value Practice · Easy
  16. 16 Not solved yet. Loop labels and labeled blocks Practice · Medium
  17. 17 Not solved yet. Ranges: .., ..=, and range patterns Practice · Easy
  18. 18 Not solved yet. Return minimum, maximum and mean as a tuple Practice · Easy
  19. 19 Not solved yet. Arrays: the length is part of the type Practice · Easy
  20. 20 Not solved yet. Remove duplicates while preserving order Practice · Easy
  21. 21 Not solved yet. Find the largest window sum with slices Practice · Medium
  22. 22 String vs &str, part 1: the memory model Read
  23. 23 Not solved yet. String vs &str, part 2: functions that take and return text Practice · Medium
  24. 24 Not solved yet. UTF-8 strings: bytes, scalar values and slicing Practice · Hard

Check yourself

4 questions · not saved while you're signed out

Use these questions to check your understanding and compare explanations. Your score does not affect track completion.

0 / 4 correct

What does this conversion from i32 to i8 print?

Choose one answer to reveal the explanations. Answers are kept only while this page is open.

fn main() {
    let small = i32::MAX as i8;
    println!("{small}");
}
Question 1 of 4