🤯 2 + 3 % 4 * 5 in Swift is 17, not 5.
🧠 % and * have higher precedence than +
👈 They share a level, so they group from the left
✅ (3 % 4) * 5 = 15, then 2 + 15 = 17
🧵
🤯 2 + 3 % 4 * 5 in Swift is 17, not 5. 🧠 % and * have higher precedence than + 👈 They share a level, so they group from the left ✅ (3 % 4) * 5 = 15, then 2 + 15 = 17 🧵
0 vue
Publié le 21/11/2026 08:47
1:11
🤯 2 + 3 % 4 * 5 in Swift is 17, not 5.
🧠 % and * have higher precedence than +
👈 They share a level, so they group from the left
✅ (3 % 4) * 5 = 15, then 2 + 15 = 17
🧵
🛠️ Extra parentheses never change the result, only how fast someone can read it
🎯 Write for the reader, not for the table
#Swift
www.udemy.com/course/swift...