math question


Closed Thread
Results 1 to 4 of 4

Thread: math question

Hybrid View

  1. #1
    Join Date
    Aug 2008
    Posts
    42

    Default math question

    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!!

  2. #2
    Join Date
    Nov 2008
    Posts
    60


    Did you find this post helpful? Yes | No

    Default Re: math question

    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.
    Regards
    CharlieM
    Using PBP3
    MCSPX

  3. #3
    Join Date
    Apr 2007
    Location
    Pennsylvania, USA
    Posts
    158


    Did you find this post helpful? Yes | No

    Default Re: math question

    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.
    Last edited by spcw1234; - 6th March 2012 at 12:24.
    Shawn

  4. #4
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,648


    Did you find this post helpful? Yes | No

    Default Re: math question

    using the very unknown SEARCH function of this forum ...

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

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts