Control flow is a fundamental concept in any programming language, including Rust. The if-else
statement is a basic control flow construct that allows you to execute different code blocks based on certain conditions.
In this challenge, you will write a function is_even(n: i32) -> bool
that checks if a given number is even or odd using an if-else
statement. The function should return true
if the number is even, and false
if it is odd.
if-else
statement to determine if the number is even.true
if the number is even.false
if the number is odd.infamous-711
pub fn is_even(n: i32) -> bool { // Your code here... n % 2 == 0}
jhq223
pub fn is_even(n: i32) -> bool { n%2==0}
ThatphumCpre
pub fn is_even(n: i32) -> bool { return n%2==0;}
ThatphumCpre
pub fn is_even(n: i32) -> bool { return n%2==0;}
francisco-cmyk
pub fn is_even(n: i32) -> bool { n % 2 == 0}
xbarnett
pub fn is_even(n: i32) -> bool { n % 2 == 0}
carlos-quantexai
pub fn is_even(n: i32) -> bool { if n % 2 == 0 { true } else { false }}
mk-comm
pub fn is_even(n: i32) -> bool { if n % 2 == 0 { return true } else { return false } // Your code here...}
MosesMp3
pub fn is_even(n: i32) -> bool { if n % 2 ==0{ return true; } else { return false; }}
nordicmachine
pub fn is_even(n: i32) -> bool { // Your code here... if n % 2 == 0 { return true } else { return false }}
majesticalcreature
pub fn is_even(n: i32) -> bool { // Your code here... n % 2 == 0}
josschne
pub fn is_even(n: i32) -> bool { // Your code here... if n % 2 == 0 {true} else {false}}
sander-b-postnl
pub fn is_even(n: i32) -> bool { n % 2 == 0}
matei
pub fn is_even(n: i32) -> bool { if n % 2 == 0 { return true; } return false;}
Mitrodan
pub fn is_even(n: i32) -> bool { n % 2 == 0 }
hendrikdevloed
pub fn is_even(n: i32) -> bool { n % 2 == 0}
amassare
pub fn is_even(n: i32) -> bool { // Your code here... n%2==0}
edoardo-morosanu
pub fn is_even(n: i32) -> bool { if n % 2 == 0 { true } else { false }}
zavakid
pub fn is_even(n: i32) -> bool { // Your code here... if n % 2 == 0 { true } else { false }}
victorchukwuemeka
pub fn is_even(n: i32) -> bool { // Your code here... n % 2 == 0}
Johnchoi913
pub fn is_even(n: i32) -> bool { // Your code here... n % 2 == 0}
Parallaxes
pub fn is_even(n: i32) -> bool { // Your code here... n & 1 == 0}
Parallaxes
pub fn is_even(n: i32) -> bool { // Your code here... n & 1 == 0}
brum-b0
pub fn is_even(n: i32) -> bool { // Your code here... if n % 2 == 0 { true } else { false }}
tiagombsilva
pub fn is_even(n: i32) -> bool { // Your code here... return n % 2 == 0;}
i5-650
pub fn is_even(n: i32) -> bool { // Your code here... n % 2 == 0}
retinotopic
pub fn is_even(n: i32) -> bool { let mut iseven: bool = false; if n % 2 == 0 { iseven = true; } iseven}
hhornbacher
pub fn is_even(n: i32) -> bool { // Your code here... n % 2 == 0}
ogaca42
pub fn is_even(n: i32) -> bool { n % 2 == 0}
st01011
pub fn is_even(n: i32) -> bool { if n % 2 == 0{ return true } else { return false }}
Ustin
pub fn is_even(n: i32) -> bool { // Your code here... if n % 2 == 0 { true } else { false }}
pbjarterot
pub fn is_even(n: i32) -> bool { // Your code here... n % 2 == 0}
otherJL0
pub fn is_even(n: i32) -> bool { n % 2 == 0}
CianciuStyles
pub fn is_even(n: i32) -> bool { // Your code here... if n % 2 == 0 { return true; } else { return false; }}
ayushrawat10
pub fn is_even(n: i32) -> bool { // Your code here... match n%2 { 0 => true, _ => false, }}
Araden14
pub fn is_even(n: i32) -> bool { let mut result: bool = false; if n % 2 == 0 { result = true; } else { result = false; } result }
damascussteel21
pub fn is_even(n: i32) -> bool { // Your code here... if n % 2 == 0 { true } else { false }}
daanbouwman19
pub fn is_even(n: i32) -> bool { // Your code here... n % 2 == 0 }
agegorin
pub fn is_even(n: i32) -> bool { n % 2 == 0}
alexromanov
pub fn is_even(n: i32) -> bool { // Your code here... n % 2 == 0}
LaurentiuStoleriu
pub fn is_even(n: i32) -> bool { // Your code here... if n % 2 == 0 { return true; } false}
oneopane
pub fn is_even(n: i32) -> bool { // Your code here... if n % 2 == 0 { true } else { false }}
bmelancon
pub fn is_even(n: i32) -> bool { // Your code here... if n % 2 == 0 {true} else {false}}
yurm04
pub fn is_even(n: i32) -> bool { // Your code here... if (n % 2) == 0 { true } else { false }}
Xinoi
pub fn is_even(n: i32) -> bool { if n % 2 == 0 { true }else { false }}
AtJiawei
pub fn is_even(n: i32) -> bool { // Your code here... let remainder = n % 2; if remainder == 0 { true } else{ false }}
Aditeya
pub fn is_even(n: i32) -> bool { // Your code here... n % 2 == 0}
edgarcnp
pub fn is_even(n: i32) -> bool { n % 2 == 0}
abhiyan-chhetri
pub fn is_even(n: i32) -> bool { // Your code here... if n % 2 == 0 { return true; } else { return false; }}
Sommos
pub fn is_even(n: i32) -> bool { // Your code here... if n % 2 == 0 { true } else { false }}