Passer au contenu principal
Bluvy Tube
Appuyez sur Échap pour quitter le plein écran
Volume m
/
i
Mode Cinéma t
f
/
🤯 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 🧵

Raccourcis clavier

Espace K
Lecture / pause
← →
Reculer / avancer de 5 s
J L
Reculer / avancer de 10 s
0–9
Aller à 0 %–90 % de la vidéo
Home End
Début / fin
, .
Image précédente / suivante (en pause)
< >
Ralentir / accélérer
↑ ↓
Volume
M
Couper / rétablir le son
C
Sous-titres
F
Plein écran
I
Image dans l’image
T
Mode cinéma
?
Afficher cette aide

🤯 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 🧵

Cane Allesta

Cane Allesta

@caneallesta.bsky.social

S'abonner
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 🧵
2 commentaires
?
that one would totally get me too, i always add the parentheses anyway. do beginners trip over operator precedence a lot?
It’s not something you encounter in your day-to-day work, but it can certainly trip you up during a technical interview.
⚠️ Same idea: 7 % 4 * 2 = 6, but 7 % (4 * 2) = 7
🛠️ Extra parentheses never change the result, only how fast someone can read it
🎯 Write for the reader, not for the table

#Swift
Voir le post d'origine sur Bluesky
Lien copié dans le presse-papier

Connexion

Il est temps de faire une pause

Ça fait 30 minutes que vous enchaînez les vidéos : accordez-vous 5 minutes loin de l'écran. Levez-vous, étirez-vous, buvez un verre d'eau… Les vidéos vous attendront ici.