IonicWind Software

IWBasic => General Questions => Topic started by: Logman on March 03, 2009, 09:24:20 AM

Title: Comments
Post by: Logman on March 03, 2009, 09:24:20 AM
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?
Title: Re: Comments
Post by: fasecero on March 03, 2009, 09:58:44 AM
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

Title: Re: Comments
Post by: Logman on March 03, 2009, 01:40:05 PM
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
Title: Re: Comments
Post by: Parker on March 03, 2009, 03:24:24 PM
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.