typeover
rust curriculum

Curriculum Data modeling Option instead of null exercise 3 · mcq-explain

Option instead of null

Pick the strongest reason to handle Option<T> with match (or if let) rather than .unwrap().

TypeScript reference
Pick the correct explanation

About this theme

Rust does not have null; absence is Option<T>. TypeScript users already know T | null; Rust makes the check mandatory before access. Planned exercises: 1. choose Option<T>. 2. recognise Some and None. 3. choose match over unchecked access. 4. fill Some(value). 5. fill unwrap_or. 6. write a function returning Option. 7. write if let Some. 8. translate TS nullable code. 9. fix a program by handling the None case explicitly.