Solution Review 1: Check If Even or Odd
This lesson gives a detailed solution review of the challenge in the previous lesson.
We'll cover the following...
Solution:
Press + to interact
fn test(_a:i32) {// check divisibility by 2if _a % 2 == 0 { // execute if divisibleprintln!("Number {} is even", _a);}else { // execute if not divisibleprintln!("Number {} is odd", _a);}}
Explanation
Note: The statement ...