Shop OBEX P1 Docs P2 Docs Learn Events
Endif — Parallax Forums

Endif

ArchiverArchiver Posts: 46,084
edited 2003-12-05 18:56 in General Discussion
Hi all
I have notice on a number of post that people add at the end of a IF THEN
statement ENDIF

example
FOR i=0 to 15 ' bit by bit multiply, low word
IF X0.bit0(i)=1 THEN ' add conditional
Z0=Z0+Y0
Z1=Z1+Y1
IF Z0<Y0 THEN Z1=Z1+1 ' carry
ENDIF
Y1 = Y1 << 1 | Y0.bit15 ' Y1:Y0 * 2
Y0 = Y0 << 1
NEXT
FOR i=0 to 15 ' continue to the high word
IF X1.bit0(i)=1 THEN
' Y0=0 by this point
Z1=Z1+Y1 ' drop carry beyond 32 bits
ENDIF
Y1 = Y1 << 1
NEXT
If i put more than on ENDIF in my programs it comes up with this has already
been defined.

It maybe that I am just missing something as a newbie but could someone please
explain its relevance in a program for me.

Thank You
Rob

[noparse][[/noparse]Non-text portions of this message have been removed]

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2003-12-05 04:05
    Make sure you specify version 2.5 syntax:

    ' {$PBASIC 2.5}

    I pasted your code into the editor, specified 2.5 and it compiles
    without complaint.

    -- Jon Williams
    -- Applications Engineer, Parallax
    -- Dallas Office


    Original Message
    From: Rob Farrand ... FTech Connection
    [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=JU38y07w4kT_SvdUfImgm8NPCU1bTvfQ-lXzT6kZMiW76oMAaqb_MWWumCJjTifEMD235dYBZrsy3iMCTzQQu4M]ftech@n...[/url
    Sent: Thursday, December 04, 2003 9:36 PM
    To: basicstamps@yahoogroups.com
    Subject: [noparse][[/noparse]basicstamps] ENDIF


    Hi all
    I have notice on a number of post that people add at the end of a IF
    THEN statement ENDIF

    example
    FOR i=0 to 15 ' bit by bit multiply, low word
    IF X0.bit0(i)=1 THEN ' add conditional
    Z0=Z0+Y0
    Z1=Z1+Y1
    IF Z0<Y0 THEN Z1=Z1+1 ' carry
    ENDIF
    Y1 = Y1 << 1 | Y0.bit15 ' Y1:Y0 * 2
    Y0 = Y0 << 1
    NEXT
    FOR i=0 to 15 ' continue to the high word
    IF X1.bit0(i)=1 THEN
    ' Y0=0 by this point
    Z1=Z1+Y1 ' drop carry beyond 32 bits
    ENDIF
    Y1 = Y1 << 1
    NEXT
    If i put more than on ENDIF in my programs it comes up with this has
    already been defined.

    It maybe that I am just missing something as a newbie but could someone
    please explain its relevance in a program for me.

    Thank You
    Rob

    [noparse][[/noparse]Non-text portions of this message have been removed]


    To UNSUBSCRIBE, just send mail to:
    basicstamps-unsubscribe@yahoogroups.com
    from the same email address that you subscribed. Text in the Subject
    and Body of the message will be ignored.


    Your use of Yahoo! Groups is subject to
    http://docs.yahoo.com/info/terms/




    This message has been scanned by WebShield. Please report SPAM to
    abuse@p....
  • ArchiverArchiver Posts: 46,084
    edited 2003-12-05 18:56
    The earlier version of PBasic (pre 2.5) only
    had an IF ... THEN <goto_label>. The new version
    now has a true multiline IF/THEN/ELSE/ENDIF
    construct.

    --- In basicstamps@yahoogroups.com, "Rob Farrand ... FTech
    Connection" <ftech@n...> wrote:
    > Hi all
    > I have notice on a number of post that people add at the end of a
    IF THEN statement ENDIF
    >
    > example
    > FOR i=0 to 15 ' bit by bit multiply, low word
    > IF X0.bit0(i)=1 THEN ' add conditional
    > Z0=Z0+Y0
    > Z1=Z1+Y1
    > IF Z0<Y0 THEN Z1=Z1+1 ' carry
    > ENDIF
    > Y1 = Y1 << 1 | Y0.bit15 ' Y1:Y0 * 2
    > Y0 = Y0 << 1
    > NEXT
    > FOR i=0 to 15 ' continue to the high word
    > IF X1.bit0(i)=1 THEN
    > ' Y0=0 by this point
    > Z1=Z1+Y1 ' drop carry beyond 32 bits
    > ENDIF
    > Y1 = Y1 << 1
    > NEXT
    > If i put more than on ENDIF in my programs it comes up with this
    has already been defined.
    >
    > It maybe that I am just missing something as a newbie but could
    someone please explain its relevance in a program for me.
    >
    > Thank You
    > Rob
    >
    > [noparse][[/noparse]Non-text portions of this message have been removed]
Sign In or Register to comment.