I am trying to figure how to code a line which essentially is:
"If x greater than or equal to y(+ or - 1)"
but how am I able to do that? I'm trying to figure out an appropriate notation but am struggling a bit so I would appreciate some help, thank you!
EDIT:
Apologies for the mistake, I was thinking two different things and mistook what I was originally going to ask. I meant to say how would I write the code for
"If x does not equal y(+ or -1)
Or in a diff notation, basically if x isn't equal to a value between y + 1 and y - 1:
"If x does not equal (y-1 < y < y +1)"
So specifically, the plus one is greater than the minus one, so all you have to do is check against the lower number. Not either or both. What John wrote.
Could you tell us the scenario you're trying to code for?
Sure, I had typed the wrong question on my part but what I meant to say, along with numerical values:
X and Y can be any arbitrary numerical value that comes from an input from an external component, like an ultrasonic sensor for eg.
If x = 5 and y = 7
I'd want to write a line that essentially follows:
If x does not equal + or - 1 y
Or with the values in
If 5 does not equal 7(+ or - 1; any value between the range of 8 and 6)
I hope this helps.
If the condition is satisfied then the code will carry on, but really I just need to know how write the part I wrote above in code.