PDA

View Full Version : math question



Picstar
- 6th March 2012, 09:15
Hello All,
In a program that i'm working on, I need to pick from a range of numbers. For example, If variable B1 returns a value of say 100, but you want to 98,99,100,101 or 102 to be acceptable, is this possible? show an example please. Thanks to all reading and responding!!

c_moore
- 6th March 2012, 10:25
You could try using select case. Then you could say something like
select case B1
case 98 to 102
do something

end select

This is not tested but may work.

spcw1234
- 6th March 2012, 12:16
IF B1<B+2 AND B1>B-2 THEN do something here.

That should give you B +or- 2 which you would have to set to 100.

This may or not do what you want, but it might help.

Acetronics2
- 6th March 2012, 12:18
using the very unknown SEARCH function of this forum ... :ambivalence:

http://www.picbasic.co.uk/forum/showthread.php?t=3625

Alain