June 26, 2024, 06:36:44 AM

News:

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


Comments

Started by Logman, March 03, 2009, 09:24:20 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Logman

I notice that the manual defines single (' or REM) and block (/* ... */) comments.

When I add either type to the end of a line it works.

Example: PRINT "This is a string literal." 'This is a comment

However, I notice that in the manual/help file, there is a colon placed between the line and comment.

Example: PRINT "This is a string literal." : 'This is a comment

There is no mention of having to place the colon other than being shown in the examples. Is it good practice in EBasic to use the colon or can we do without?
Education is what you get when you read the fine print.<br />Experience is what you get when you don't!

fasecero

There is no need to use the colon in your example. The colon is used to write several statements in one line:


INT a : a=0 : a=a+1


Logman

Thanks fasecero.

I was hoping that there weren't any reasons to have to use colons between code and comments on the same line.

Paul
Education is what you get when you read the fine print.<br />Experience is what you get when you don't!

Parker

The colon is because in the old IBasic (and therefore CreativeBASIC) it was necessary to separate comments with a colon - my best guess would be that they are considered separate statements. However, it's not necessary in EBasic anymore.