IF THEN in BASIC

Questions about the BASICtools and MakeItC
YahooArchive
Posts: 1462
Joined: Fri Oct 19, 2012 5:11 am

Re: IF THEN in BASIC

Post by YahooArchive »

Hi Ira,
I tried your test code and it ran just fine. I've never had trouble with basic
code but for some reason I must be making some kind of syntax error that I
didn't realize.
I'll keep you posted.
Dan



YahooArchive
Posts: 1462
Joined: Fri Oct 19, 2012 5:11 am

Re: IF THEN in BASIC

Post by YahooArchive »

Hi Ira,
You hit the nail on the head. I eliminated the THEN from my statements and it
worked. Very strange. The help menu shows a then statement with every IF or
ELSEIF. I always thought the language required a THEN statement to delineate
what must be done after the IF statement was found to be true.
Go Figure.
Thanks for your help!!
DanÂ

YahooArchive
Posts: 1462
Joined: Fri Oct 19, 2012 5:11 am

Re: IF THEN in BASIC

Post by YahooArchive »

> You hit the nail on the head. I eliminated the THEN from my statements and
it worked. Very strange. The help menu shows a then statement with every IF
or ELSEIF. I always thought the language required a THEN statement to
delineate what must be done after the IF statement was found to be true.

I'm not sure you really found the cause here. ARMbasic follows the VB syntax of
requiring a THEN in a single line IF, but making it optional in a multiline
IF..ENDIF

Just to check I typed this into DEMO mode of BASICtools

print 1234
if x=1 then
print 4321
else
print 1111
endif
print 4444
run
***DEMO MODE*** loading PC...

ARMbasic[7.43g] on the PC Copyright 2008, Coridium Corp.
"... 0.11K code 0.01K data programmed


"

Executing on the PC...
1234
1111
4444

============================

So maybe it's some control characters being inserted by whatever text editor you
are using.

YahooArchive
Posts: 1462
Joined: Fri Oct 19, 2012 5:11 am

Re: IF THEN in BASIC

Post by YahooArchive »

Hi Daniel,

What email client are you using ?

Or are you Canadian ? ;-)


don

YahooArchive
Posts: 1462
Joined: Fri Oct 19, 2012 5:11 am

Re: IF THEN in BASIC

Post by YahooArchive »

Hi Don,
I'm using Yahoo mail and I'm in the Seattle area.  I'm still trying to figure
out why my program compiles without then commands. I am using endif with all
if statements and it works.
Dan

YahooArchive
Posts: 1462
Joined: Fri Oct 19, 2012 5:11 am

Re: IF THEN in BASIC

Post by YahooArchive »

Hi,
And no I didn't post any code as the help I got finally led me to the right
answer. I am now using ENDIF with all IF statements and they are compiling.Â
I haven't finished assembling my control and display boards so I havent' tested
the code yet but at least I can get the entire program to compile.
I really appreciate everybody's help and suggestions. I was totally amazed at
the response to my question.
Thanks again and Happy New Year, Feliz Navidad
Dan

Post Reply