Re: BBC BASIC (V 1.29) and IF Statments
- From: Martin Wuerthner <spamtrap@xxxxxxxxxxxxxxx>
- Date: Wed, 25 Apr 2007 11:54:22 +0200
In message <2aFXh.65$en5.44@xxxxxxxxxxxxxxxxxxxx>
Michael Emerton <MichaelREmerton@xxxxxxxxxxxxxxxxxxxxx>
wrote:
IF direction% = 0
direction% = 1
PRINT STR$(direction%)
ELSE
direction% = 0
PRINT STR$(direction%)
ENDIF
However (If anyone notices ;@)) There is a "THEN" Missing.
Yes. If my memory serves correctly, this gets parsed as meaning:
IF direction% <> 0 THEN = 0
No.
Which means "If direction is non-zero, return from function returning
zero" which is obviously not what you want. Always use the THEN.
oooo, useful to note that!
No, better not note that explanation because it is wrong (of course,
the recommendation to always use the THEN is right). The above is
parsed as meaning:
IF direction% = 0 THEN REM do nothing
There is definitely no function return involved. If it was you would
have seen a "Not in a function" error unless the above code happened
to be inside a function.
Martin
--
---------------------------------------------------------------------
Martin Wuerthner MW Software http://www.mw-software.com/
ArtWorks 2 -- Designing stunning graphics has never been easier
spamtrap@xxxxxxxxxxxxxxx [replace "spamtrap" by "info" to reply]
.
- References:
- BBC BASIC (V 1.29) and IF Statments
- From: Michael Emerton
- Re: BBC BASIC (V 1.29) and IF Statments
- From: Rob Kendrick
- Re: BBC BASIC (V 1.29) and IF Statments
- From: Michael Emerton
- BBC BASIC (V 1.29) and IF Statments
- Prev by Date: Re: BBC BASIC (V 1.29) and IF Statments
- Next by Date: Re: BBC BASIC (V 1.29) and IF Statments
- Previous by thread: Re: BBC BASIC (V 1.29) and IF Statments
- Next by thread: Re: BBC BASIC (V 1.29) and IF Statments
- Index(es):
Relevant Pages
|