← Back to Examples

Two Exercises in One Chapter

double-b
⭐⭐ intermediate ⏱️ 10 min

Some intro text here to demonstrate content before and between exercises.

Exercise A

Implement add(a, b).

b.rs
⚠️ Try the exercise first! Show Solution
pub fn factorial(n: u64) -> u64 {
    (1..=n).product()
}

🧪 Tests

View Test Code
#[test]
fn fact_small() { assert_eq!(factorial(5), 120); }