getting around the basic IF - THEN statement


Closed Thread
Results 1 to 4 of 4
  1. #1
    dw_pic's Avatar
    dw_pic Guest

    Default getting around the basic IF - THEN statement

    Hi all,

    Prior to Picbasic Pro, the IF statement is limited as a simple GOTO.

    It seems like I remember creating an AND statement that worked as a pseudo IF statement. like this.

    B0 = 5 AND B1 = 25

    in other words: If B1 = 25 Then make B0 5

    Or perhaps there is another way to do this that you have found??
    tnx,
    dw

  2. #2
    Join Date
    Nov 2004
    Posts
    61


    Did you find this post helpful? Yes | No

    Default

    You mean something like this?

    If B1 =25 Then
    B0 = 5
    ENDIF

  3. #3
    dw_pic's Avatar
    dw_pic Guest


    Did you find this post helpful? Yes | No

    Default

    That't the desired end result.

    However, prior to PicBasic Pro compiler (which I don't yet have) statements, the IF statement was not this powerful. You are limited to a simple GOTO.

    i.e.

    B0 = 1
    IF B0 = 1 THEN STEP_1
    IF B0 = 5 THEN STEP_3

    STEP_1:
    'do something fun here

    STEP_3
    'do something crazy here

    So, I seem to remember getting creative with the AND statement where I could modify variables without the IF statement.

    i.e.

    B0 = 5 and B1 = 25

    Thanks
    dw

  4. #4
    Join Date
    Aug 2003
    Location
    Northern California
    Posts
    14


    Did you find this post helpful? Yes | No

    Default IF-THEN Standard PIC Compiler

    ' * * * IF B0 = 25 THEN B1 = 5 * * *

    IF B0 = 25 THEN SET_B1

    IF B0 <> 25 THEN NOTHING

    SET_B1:
    B1 = 25

    NOTHING:
    ' * * * Continue * * *

Similar Threads

  1. Indexer not indexing...a basic PBP problem??
    By jellis00 in forum General
    Replies: 8
    Last Post: - 24th March 2009, 16:53
  2. Loop with two motor and 2 sensors
    By MrRoboto in forum mel PIC BASIC
    Replies: 4
    Last Post: - 8th December 2008, 23:40
  3. pic Basic Pro 2.50a & debug statement
    By Phil Moore in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 17th March 2008, 09:41
  4. NEWBIE: Some basic questions using interrupts
    By JackPollack in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 8th March 2006, 02:59
  5. vb6 to pic basic
    By Darrenmac in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 19th December 2005, 01:56

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