Rust: Decisions


Example: IF statement with String


	fn main() {
		let employee_name = "John Smith";
		if employee_name == "John Smith" {
			println!("{} is an employee.", employee_name);
		}
	}
	

Output:

  John Smith is an employee.


Example: IF-ELSEIF-ELSE with integer


	fn main() {
		let score = 205;
		
			if score == 0 {
				print!("{} is a perfect game.", score);
			} else if score > 200 {
				print!("{} is a great game!", score);
			} else {
				print!("{} is good game.", score);
			}
	}
	

Output:

  205 is a great game!