GML Overview: If

An if statement has the form

if or

if else The statement can also be a block. The expression will be evaluated. If the (rounded) value is <=0 (false) the statement after else is executed, otherwise (true) the other statement is executed. It is a good habit to always put curly brackets around the statements in the if statement. So best use

if { }    else { }

Example The following program moves the object toward the middle of the screen.

{   if (x<200) {x += 4} else {x -= 4}; }