Computer Science Canada

If command help

Author:  Impatientcow915 [ Fri May 15, 2015 7:49 am ]
Post subject:  If command help

Can you do this
If x < ( or >) y by 5

Author:  Dreadnought [ Fri May 15, 2015 9:02 am ]
Post subject:  Re: If command help

What exactly do you expect the behavior to be?

My best guess is is that you want to do something for each of x, x+5, x+10, ... if they are less/greater than y? In that case you would need a for loop and an if statement within it.

Author:  DemonWasp [ Fri May 15, 2015 12:09 pm ]
Post subject:  RE:If command help

It seems like you want to check whether X and Y are more than 5 (units?) apart.

So you want to check whether the difference between X and Y has a magnitude of more than 5.

You can find the difference between numbers by subtraction.

You can find the magnitude of a number with the abs(x) function.


: