Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 If command help
Index -> Programming, Turing -> Turing Tutorials
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Impatientcow915




PostPosted: Fri May 15, 2015 7:49 am   Post subject: If command help

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




PostPosted: 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.
DemonWasp




PostPosted: 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.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Tutorials
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: