September 26, 2020, 06:05:09 pm


Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........

I think you've made an error Sir ..

Started by GWS, September 18, 2011, 07:41:03 am

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.



In a discussion of coding error handling in the IWB section, it occurred to me that newcomers might wonder what sort of help they can expect from Creative Basic if they make a coding error - easily done ..  ;D

So what error messages might you get if you mis-type your code?

Here's a little test program to check out some possible errors that might occur ..

Code Select

DEF a,b:int

PRINT "hello"

IF a = 5
   b = 10


And here are some errors with their associated CB error messages ..

Missing 'int' on line 1
Unknown Type on line 1.

Missing 'open quote' on line 4
Undefined variable on line 4 - 'hello'" Not Found.

Missing '=' on line 6
Undefined variable on line 6 - 'a5' Not Found.

Missing 'ENDIF' on line  6
IF without ENDIF on line 6.

Missing 'UNTIL' on line 10
DO without UNTIL on line 10.

Missing 'E' from the end of CLOSECONSOLE
Syntax error on line 11.

Missing END statement
No error flagged - program runs normally.

As you can see, Creative watches carefully what you might be doing wrong, and gives pretty good hints to highlight the problems.

If you correct the omissions and click GO .. off you go again, no problem.

Of course, in a bigger program, with more obscure errors, you might get an error message that's not too clear - but usually it will indicate the problem adequately.

all the best, :)


Tomorrow may be too late ..