Hi.
I was just playing around with a loop which required a value of a variable to be between two values. The normal way seems to be a double expression, i.e.
UNTIL A% > 10 AND A% < 20
Is there any way a combined expression could be used? I.e.
[ UNTIL 10 < A% < 20 ]
I tried playing around with various formats/parentheses, but was unable to come up with any combination that worked. Is this one of those examples that just wont work in BASIC?
Matt
Less Than, Greater Than
Re: Less Than, Greater Than
Hi Matt,
In that case, I guess you could use
UNTIL ABS(15-A%)>4
...but I'm not sure it would be significantly faster, and I'm fairly sure it's significantly less clear (and you have to be more careful about boundary conditions), so I'm not sure I'd recommend it.
Best wishes,
D
In that case, I guess you could use
UNTIL ABS(15-A%)>4
...but I'm not sure it would be significantly faster, and I'm fairly sure it's significantly less clear (and you have to be more careful about boundary conditions), so I'm not sure I'd recommend it.
Best wishes,
D
-
- Posts: 177
- Joined: Mon 02 Apr 2018, 21:51
Re: Less Than, Greater Than
DDRM is right. It's best to just write A% > 10 AND A% < 20.