if / else and the % operator
if runs code only when something is true. == checks if two things are equal. % gives the remainder after dividing — so b % 2 == 0 is true on even beats.
🔢 Math connection: % is the remainder from division: 7 ÷ 2 = 3 remainder 1, so 7 % 2 is 1. A remainder of 0 means even. RockBlocks Math: Grade 4 · Division with Remainders ↗
Challenge A:Loop through beats 1-8, but only play the snare if b == 4. (Two = signs checks; one stores.)