In this challenge, you will create a function that determines the characteristics of a given number. Specifically, the function will evaluate whether a number is positive negative, or zero and also determine if it is even or odd.
Rust's powerful control flow mechanisms, including if
, else if
, and else
statements, make it easy to handle multiple conditions. By combining these conditions with logical operators, you can create a function that provides comprehensive information about the number.
You are given a function describe_number(n: i32) -> String
that takes an integer as input and returns a string description of the number's characteristics. The description should include whether the number is positive, negative, or zero and whether it is even or odd.
For example:
Complete the function by implementing the necessary conditions and logical checks.
%
can help determine if a number is even or odd.&&
and ||
will be useful for combining conditions.