Hi! I know this is simple but I don't know how, I tried searching lol.
what's the code if I wan't ex.
if(mine > yours) {
but what i want is to add range.
I'll write it in english since I don't know the code.
"If mine is greater than 10 than yours"
what's the code for this? thanks!
cmiyc
September 30, 2013, 2:24am
2
Tamulmol:
"If mine is greater than 10 than yours"
I don't know I understand what you're saying there.
if ((mine > (yours+10)) {
If yours is 5 then this would be the same as mine > 15.
or
if ((mine > yours) && (yours > 10)) {
If yours is 5, this would evaluate false.
Tamulmol:
"If mine is greater than 10 than yours"
I don't know I understand what you're saying there.
if ((mine > (yours+10)) {
If yours is 5 then this would be the same as mine > 15.
or
if ((mine > yours) && (yours > 10)) {
If yours is 5, this would evaluate false.
if ((mine > (yours+10)) {
Thanks! I think this is what I need.
What I want is my Servo will only move if my ultrasonic sensor 1 is 10 value higher than my ultrasonic sensor 2.
cmiyc
September 30, 2013, 2:57am
4
Tamulmol:
What I want is my Servo will only move if my ultrasonic sensor 1 is 10 value higher than my ultrasonic sensor 2.
I'm not sure why you felt the need for a layer of abstraction. That is a lot more understandable (while still somewhat difficult) than your previous nonsense statement.
yah but you answered my nonsense statement correctly. English is not my primary language, I was drinking when I was suppose to be studying.Thanks!
Not totaly sure but your statement sound like
if (mine - yours > 10) {}
Isolate the variable from the number and that look better, well according to me.