Search⌘ K

Challenge 2: Count Iterations of a Loop Until a Condition

Practice controlling loops in Rust by writing a while loop that repeatedly decreases a variable by three until it is less than zero. Learn to track and print the number of loop iterations, strengthening your understanding of loop logic and mutable variables in Rust.

Problem Statement

  • A variable x is provided to you.

  • Repeatedly decrease the value of the variable x by 3 each time, as long as x is greater than or equal ...