IF THEN in BASIC

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

IF THEN in BASIC

Post by YahooArchive »

Hi there,
This is my first post after purchasing an Armmite eval board and software.
I have been programming in basic for many years but I have come across a problem
trying to compile programs. Every .bas program I try to compile gives both a no
newline error and an Expected EndIf for the last line of code, yet there are no
incomplete If statements at the end of the program. I have tried making small
modules and then testing them and I always get the Expected EndIf error.
Please help!!
Dan



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

Re: IF THEN in BASIC

Post by YahooArchive »

I think you have run into the missing CR/LF on the last line of your source text
file problem.

Try hitting the key on the last line of your .bas text file, saving, and
then compiling.

Ira

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

Re: IF THEN in BASIC

Post by YahooArchive »

I may have been less clear than I meant to be. The needs to be on the
end of the last line in the source file.

Ira

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

Re: IF THEN in BASIC

Post by YahooArchive »

Hi Ira,
I tried resetting the newline to crlf and used the enter at the end but the
message still comes up 'no newline at end of file and the error message '
expected endif ' still occurs for the last line of the file.
I'll keep trying things but I'm just about out if ideas.
Thanks for the info.
Dan

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

Re: IF THEN in BASIC

Post by YahooArchive »

> I tried resetting the newline to crlf and used the enter at the end but the
message still comes up 'no newline at end of file and the error message '
expected endif ' still occurs for the last line of the file.

The pre-processor (derived from the C version) wants to see a blank line at the
end of an #include'd file

The expected endif would be generated if there is an IF without an ENDIF

If you can't find it with a text search, you'll have to start splitting the file
to try to locate it.

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

Re: IF THEN in BASIC

Post by YahooArchive »

> I wrote a few lines of code declaring a couple of vars and used a single if -
then- else statement to check out what the compiler would do. I did a single
crlf at the end of the last line of code and the compiler started OK. The
compiler finished with the error message 'Expected ENDIF, found end of line.Â
Any use of the IF statement generates this error message, even if you add an
ENDIF to the end of the code, you still get the error message.
> Has anyone ever come across this problem before?

No

The compiler was last updated in October with many downloads since then with no
reported problems.

What board are you using?
What firmware version does it report in the Welcome message?
What OS are you using?

...

Really have not heard of any problems like this.

Can you try another PC?
Can you send a simple example of a program that does not compile correctly?

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

Re: IF THEN in BASIC

Post by YahooArchive »

--- In ARMexpress@yahoogroups.com, Daniel Chastain
wrote:
>
> Hi Bruce,
> I think there is something wrong with my compiler even though I have deleted
and reinstalled BasicTools several times.
> I wrote a few lines of code declaring a couple of vars and used a single if -
then- else statement to check out what the compiler would do. I did a single
crlf at the end of the last line of code and the compiler started OK. The
compiler finished with the error message 'Expected ENDIF, found end of line.Â
Any use of the IF statement generates this error message, even if you add an
ENDIF to the end of the code, you still get the error message.
> Has anyone ever come across this problem before?
> Thanks for your help.
> Dan
>

Looking at your email message above there is a strange character  at the end of
each line. If the same thing is happen in your source code maybe this is a
Unicode / Character set-related problem?

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

Re: IF THEN in BASIC

Post by YahooArchive »

Hi again,
I have not been able to figure out what firmware I have on the ARMmite eval
board. There is no firmware number and no welcome screen when I open
BasicTools. I have been to the Coridium website trying to get information but
to no avail. It appears that I need to buy my firmware which I find rather
strange since you usually have to have firmware to interface with the XP
operating system. to begin with. The basic Coridium uses is a bit different
from the QuickBasic I used to use for my programming projects. It appears that
the command needs to be the last thing the compiler sees on each line besides
CRLF.
Where can I find the info on the firmware on my Eval board?
Or do I just have to bite the bullet and pay more money for the system.
This has turned into a steeper learning curve than I expected.
I really appreciate your help.
DanÂ

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

Re: IF THEN in BASIC

Post by YahooArchive »

Dan,

Your problem seems so familiar that it's driving me crazy. I think I ran into
the same thing. I looked at some of my source (with lot's of IF's) and I am
using "END IF" (with a space) in some and ENDIF (without a space in others. The
Basic manual shows "Version 7.00 allows ENDIF or END IF syntax". I just tested
it with these two programs:

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

Print "Hello"

If a = 1
print "Goodbye"
End If

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

Print "Hello"

If a = 1
print "Goodbye"
EndIf

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

Both worked fine ("Goodbye" does not print.)

Did you buy an older board? Perhaps it's an older version of the firmware.

Try it with a space and let us know.

Ira

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

Re: IF THEN in BASIC

Post by YahooArchive »

Hi,
I have always set my mail to reply with the same character set as the original
sender. I saw the odd capital A at several points in the message but I'm not
sure why this would happen. I've been using the same reply arrangement for
several years. I wonder if Yahoo has somehow changed my settings.
I'l check it out.
Thanks,
Dan

Post Reply