I want to make sure with this If-line
that variable C is between 10 and 25 and B is between 10 and 24.
Does > or < not work after an If?
Should I use lists instead? (like {10,11,...,25})


Code:
If C<10 xor C>25 xor B<10 xor B>24
Then
Stop
Else
...
Why not just:

Code:
If C>=10 and C<=25 and B>=10 and B<=24
Hey, great!
I will try it!
I don't know why you're using xor there, also your signs are the complete opposite of what they should be if you're wanting to check if the value is between two numbers.

Here's what you want to do:

Code:
If C>=10 and C<=25 and B>=10 and B<=24


Edit: looks like Noah beat me to it
"Stop" was just an example. It exits the program when condidions are true.
I know it causes a memory leak. I wont use it in a normal program.
But you are right: I don`t need xor in this case.
Michael2_3B wrote:
I don't know why you're using xor there, also your signs are the complete opposite of what they should be if you're wanting to check if the value is between two numbers.

Here's what you want to do:

Code:
If C>=10 and C<=25 and B>=10 and B<=24


Edit: looks like Noah beat me to it

You can use abs() to make things like this smaller:

Code:
If C>=10 and C<=25 and 7>=abs(B-17

And preferably with colors if available because you save ~0.07ms per call.

Code:
If C>=BLUE and C<=25 and 7>abs(B-NAVY
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement