Skip to content
Justice Tech School

Characters and Booleans

char is a Unicode scalar value written in single quotes. bool is true or false. char has methods like is_alphabetic, to_ascii_uppercase and to_digit.

Example
let c = 'a';
println!("{} {} {:?}", c.is_alphabetic(), c.to_ascii_uppercase(), '7'.to_digit(10));
let ok = 5 > 3 && !(2 > 4);
println!("{}", ok);

Result

true A Some(7)
true

Exercise

Check for a letter.

c.is_()

Quiz Test

How is a char written?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.