samedi 2 décembre 2017

Explanation on code after if statement colon

Whilst I was learning pygame, I stumbled across a line of code that I did not understand:

if y == 0 or y == height-1: var1 *= -1

I understand what if statements are in python and the usage of logic gates, what I don't understand is the small piece of statement after the if statement: "var1 *= 1"

Can someone explain this syntax? I do not understand the code and thought it would return a syntax error if we type anything beyond a colon.

Aucun commentaire:

Enregistrer un commentaire