GLBasic forum

Main forum => GLBasic - en => Topic started by: yaKC on 2009-Dec-13

Title: Help for a newby please
Post by: yaKC on 2009-Dec-13
Hiya, just started using GLBasic a couple of days ago and already love it, however as can be expected I'm experienceing some rather weird problems.

Firstly, I have a few lines such as the following:-

IF c<>14062080 THEN LET p=p+1

and everything was working perfectly, and all of a sudden on
one of the lines it is now saying :-

(70) error : IF without ENDIF / THEN

even though it was working...

in a similar manner if i try

IF c<>14062080
LET p=p+1
ENDIF

or indeed any other IF ENDIF statement i get:-

(70) error : IF without ENDIF / THEN

even though I'm using it correctly :(

also, if i do a command like:-

IF KEY(50) and x>0 THEN LET x=x-1

it errors, forget the error, but if i only do one check in the line, like leaving out the extra AND x>0 it works

Can anybody help me please, I dearly want to start creating
games using GLBasic but everything sems to be not working as it should :(

anyway, as i say, great language and from a brief look around the forums looks like quite a community :)

Oh, and I've tried on both version 6.2 and the new version 7.
Title: Re: Help for a newby please
Post by: Ian Price on 2009-Dec-13
Try using your code without the "LET" command

Code (glbasic) Select

IF c<>14062080
p=p+1
ENDIF


or even

Code (glbasic) Select

IF c<>14062080
INC p
ENDIF


Those shouldn't bring up an errors. LET isn't necessary in GLBasic.

I'm at work so can't test this. The only other thing I can think of is that the maximum integer value for "c" has perhaps been reached (although I can't remember what the max and min values are). Try a lower value to check.
Title: Re: Help for a newby please
Post by: Moru on 2009-Dec-13
I have tested them all now with version 7.181 and they all work fine.
The error might be on a row earlier, check that all while/if/select/for and so on is matching up with the wend/endif/endselect/next statements or try the lines alone in a program to see if it still won't compile. If that works then post your whole code so we can have a look :-)
Title: Re: Help for a newby please
Post by: MrTAToad on 2009-Dec-13
Indeed - it sounds like an end terminator command is missing
Title: Re: Help for a newby please
Post by: yaKC on 2009-Dec-23
I'm sorry for not getting straight back to this... thanks for the replys and the command list looks to be a great asset whether learning the language or not.

Finally fixed this a couple of days back, and loving coding again :)

As you guys said, there didn't appear to be any problem with the code i was using, I dug a bit into the forum and found a post where someone fixed a similar problem (whereby GLBasic just wouldn't work), by downloading and installing the C++ 2005 redist... As soon as i did that everything worked fine :)

thanks, and once again, sorry for not getting straight back, appreciate the hlp ;)

edit:- and just for the laugh my game now is experiencing the same bugs as it should (porting a game of mine from an old 8-bit) :D lol