Greater than, or less than, but no less than?

BlitzMax Forums/BlitzMax Beginners Area/Greater than, or less than, but no less than?

ARCHE7YPE(Posted 2013) [#1]
Hi there, I've been using BlitzMax for some time now, mainly for simple calculation and simulation applications for research and development.

First things first, I am not a programmer, I am a designer. I design concepts and eventually engineering solutions. It's for this reason that I am not so savvy in the old code mathematics.

So far I've been able to do exactly what is needed with Blitz, but for a certain problem I am having I (think) need and expression for an If Statement that basically says:


If X = postionX and Y = positionY+50(or less than, but no lessthan -50) 
          doSomething()
Endif


There'll likely be a long line of ElseIfs and Elses to boot, but thats the jist.

There might be an entirely other method of doing this, or my brain has begun to shut down after staring at the code. I'm open to suggestions (not sleep :P)

Might I add that even though I've used multiple iterations of BASIC since the 70's BlitzMax is by far the nicest, for what I need anyway.

Any help would be much appreciated. Many thanks


Polan(Posted 2013) [#2]
Is this what you need?
if(X = positionX And Y >= -50 And y <= positionY+50)
      doSomething()
EndIf



GfK(Posted 2013) [#3]
This?
If X = positionX And Abs(Y - PositionY) <= 50
  doStuff()
EndIf
The Abs() thing returns the absolute difference between Y and positionY. In other words, if Y and positionY are 50 or less apart, that part of the equation will return True.