Alternate If-Then Statement Help


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2005
    Posts
    6

    Default Alternate If-Then Statement Help

    I was wondering if anyone could tell me if the structure of this statement is valid

    if 130 < ch1_input < 170 then
    xxx
    endif

    Or, do I need to break it up into 2 conditional statements?

  2. #2
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    947


    Did you find this post helpful? Yes | No

    Default

    I was wondering if anyone could tell me if the structure of this statement is valid

    if 130 < ch1_input < 170 then
    xxx
    endif

    Or, do I need to break it up into 2 conditional statements?
    Your statement should throw an error. You could try the following code instead
    Code:
       if (ch1_input > 130) and (ch1_input < 170) then
            xxx
       endif
    Jerson

  3. #3
    Join Date
    Jul 2005
    Posts
    6


    Did you find this post helpful? Yes | No

    Default

    Thanks for the response.

    PBP did not throw an error, that is why I was wondering. I tried it in a simple program, but it resulted in unpredictable behavior.

    Thanks again!

Similar Threads

  1. 16F883 and Problems with HIGH statement
    By aaanekre in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 29th October 2009, 01:09
  2. Unable to use the number 8 in DATA statement
    By dbachman in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 7th December 2008, 06:34
  3. END Statement
    By jderson in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 9th November 2008, 14:48
  4. using AND as an IF statement
    By dw_pic in forum mel PIC BASIC
    Replies: 27
    Last Post: - 8th June 2006, 18:05
  5. getting around the basic IF - THEN statement
    By dw_pic in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 7th February 2006, 14:10

Members who have read this thread : 1

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