Comment out a block of code?
Archiver
Posts: 46,084
Sorry in advance for the stupid question...
Is it possible to "comment out" a whole block of
code at once for testing, or do I have to do it
'one
'damned
'line
'at
'a
'time?
Is kind of a pain to disable several dozen lines
at once sometimes.
Is there an easy way out?
Thanks much!
Steve D. - official newbie stamper
----
Is it possible to "comment out" a whole block of
code at once for testing, or do I have to do it
'one
'damned
'line
'at
'a
'time?
Is kind of a pain to disable several dozen lines
at once sometimes.
Is there an easy way out?
Thanks much!
Steve D. - official newbie stamper
----
Comments
undo
Original Message
From: <laurasdog@w...>
To: <basicstamps@yahoogroups.com>
Sent: December 11, 2003 3:04 PM
Subject: [noparse][[/noparse]basicstamps] Comment out a block of code?
: Sorry in advance for the stupid question...
:
: Is it possible to "comment out" a whole block of
: code at once for testing, or do I have to do it
: 'one
: 'damned
: 'line
: 'at
: 'a
: 'time?
:
: Is kind of a pain to disable several dozen lines
: at once sometimes.
:
: Is there an easy way out?
:
: Thanks much!
:
: Steve D. - official newbie stamper
:
: ----
:
:
: To UNSUBSCRIBE, just send mail to:
: basicstamps-unsubscribe@yahoogroups.com
: from the same email address that you subscribed. Text in the Subject and
Body of the message will be ignored.
:
:
: Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
:
:
:
>Sorry in advance for the stupid question...
>
>Is it possible to "comment out" a whole block of
>code at once for testing, or do I have to do it
>'one
>'damned
>'line
>'at
>'a
>'time?
>
>Is kind of a pain to disable several dozen lines
>at once sometimes.
>
>Is there an easy way out?
>
>Thanks much!
>
>Steve D. - official newbie stamper
>
>----
Just as you have shown is as good as it gets. Sorry !
>To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
>from the same email address that you subscribed. Text in the Subject and Body
of the message will be ignored.
>
>
>Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>Is it possible to "comment out" a whole block of
>code at once for testing, or do I have to do it
>'one
>'damned
>'line
>'at
>'a
>'time?
>
>Is kind of a pain to disable several dozen lines
>at once sometimes.
>Is there an easy way out?
>Thanks much!
>Steve D. - official newbie stamper
Yes, using the # directives. (You have to be using a recent version
of the compiler, STAMPW.EXE, a free download from the Parallax web
site.)
Do like this, and you will be able to change one directive to turn
your test code on and off:
#DEFINE mytest=0 ' change to 1 to enable code below
#IF mytest=1 #THEN
'one
'damned
'line
'at
'a
'time?
#ENDIF
or if you have several alternatives, use #CASE
#SELECT mytest
#CASE 0 ' this one when mytest=0
' stuff
#CASE 1 ' when mytest=1
'one
'damned
'line
'at
'a
'time?
#ENDSELECT
You can see a bunch of examples using this at
-- regards
Tracy Allen
electronically monitored ecosystems
http://www.emesystems.com
mailto:tracy@e...
http://www.emesystems.com/BS2pbasic25.htm
laurasdog@w... writes:
> Sorry in advance for the stupid question...
>
> Is it possible to "comment out" a whole block of
> code at once for testing, or do I have to do it
> 'one
> 'damned
> 'line
> 'at
> 'a
> 'time?
>
> Is kind of a pain to disable several dozen lines
> at once sometimes.
>
> Is there an easy way out?
>
> Thanks much!
>
> Steve D. - official newbie stamper
>
Cut and paste them to a new file, then when you need them paste them back.
I've done that many times.
[noparse][[/noparse]Non-text portions of this message have been removed]
But, you can do:
GOTO SkipCode1
' My compileable but not used code....
SkipCode1:
--- In basicstamps@yahoogroups.com, laurasdog@w... wrote:
> Sorry in advance for the stupid question...
>
> Is it possible to "comment out" a whole block of
> code at once for testing, or do I have to do it
> 'one
> 'damned
> 'line
> 'at
> 'a
> 'time?
>
> Is kind of a pain to disable several dozen lines
> at once sometimes.
>
> Is there an easy way out?
>
> Thanks much!
>
> Steve D. - official newbie stamper
>
> ----
GOTO SkipA 'Comment out this line to execute the next bit of code
Your code
More of your code
SkipA:
Or you can make the jump conditional if you have related segments of code
that you want to turn on and off concurrently, or if you want to be able to
tell at a glance what you've got.
CONS Skip 14
Some code
IF (Skip = 14) THEN Skip14A ' This bit of code will be skipped when Skip =
14
Your code
More of your code
Skip14A:
Original Message
From: <laurasdog@w...>
To: <basicstamps@yahoogroups.com>
Sent: Thursday, December 11, 2003 3:04 PM
Subject: [noparse][[/noparse]basicstamps] Comment out a block of code?
> Sorry in advance for the stupid question...
>
> Is it possible to "comment out" a whole block of
> code at once for testing, or do I have to do it
> 'one
> 'damned
> 'line
> 'at
> 'a
> 'time?
>
> Is kind of a pain to disable several dozen lines
> at once sometimes.
>
> Is there an easy way out?
>
> Thanks much!
>
> Steve D. - official newbie stamper
>
> ----
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the Subject and
Body of the message will be ignored.
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
There is an easy ways to do this. What I do is to "jump over" the unwanted
code like this....
existing code
goto over 'add this line
code to skip
code to skip
code to skip
over 'add this line
rest of code
ken
Is it possible to "comment out" a whole block of
code at once for testing, or do I have to do it
'one
'damned
'line
'at
'a
'time?
Is kind of a pain to disable several dozen lines
at once sometimes.
Is there an easy way out?
[noparse][[/noparse]Non-text portions of this message have been removed]
bvbates@u... writes:
Just as you have shown is as good as it gets. Sorry !
not true, see my post
ken
[noparse][[/noparse]Non-text portions of this message have been removed]
There is an easy way to block out a section of code..
What I do is to "jump over" the unwanted code like this....
existing code
goto over 'add this line
code to skip
code to skip
code to skip
over 'add this line
rest of code
ken
Also, the only stupid questions are the one's not asked!
Sorry in advance for the stupid question...
Is it possible to "comment out" a whole block of
code at once for testing, or do I have to do it
'one
'damned
'line
'at
'a
'time?
Is kind of a pain to disable several dozen lines
at once sometimes.
Is there an easy way out?
Thanks much!
Steve D. - official newbie stamper
[noparse][[/noparse]Non-text portions of this message have been removed]
Huh? As one who begged for conditional complilation and was elated
to see it in the new editor, I don't see that:
#IF 0 #THEN
...
#ENDIF
is that much harder than C's:
/*
...
*/
Regards,
Steve
comments -- but can find no references to block comments in any other
version of BASIC. If, in fact, there is a form of BASIC that uses block
comments please share so that we can examine the model.
-- Jon Williams
-- Applications Engineer, Parallax
-- Dallas Office
Original Message
From: laurasdog@w...
[noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=JCYJl6YWqLYq5hXrTyKNZG8hVs7aHiQj0K6lhYccq8gXtR3IBev3bFt2f7P2FEfnurqg2Lgbev_Z-p589Jki4HYdE0g]laurasdog@w...[/url
Sent: Thursday, December 11, 2003 5:05 PM
To: basicstamps@yahoogroups.com
Subject: [noparse][[/noparse]basicstamps] Comment out a block of code?
Sorry in advance for the stupid question...
Is it possible to "comment out" a whole block of
code at once for testing, or do I have to do it
'one
'damned
'line
'at
'a
'time?
Is kind of a pain to disable several dozen lines
at once sometimes.
Is there an easy way out?
Thanks much!
Steve D. - official newbie stamper
----
To UNSUBSCRIBE, just send mail to:
basicstamps-unsubscribe@yahoogroups.com
from the same email address that you subscribed. Text in the Subject
and Body of the message will be ignored.
Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/
This message has been scanned by WebShield. Please report SPAM to
abuse@p....
jwilliams@p... writes:
> During the development of the latest compiler we discussed adding block
> comments -- but can find no references to block comments in any other
> version of BASIC. If, in fact, there is a form of BASIC that uses block
> comments please share so that we can examine the model.
>
Jon, I use both Basica and QBasic and the only comment control I have ever
seen is the REM command.
Sid
[noparse][[/noparse]Non-text portions of this message have been removed]
fine<G>.
Original Message
From: Newzed@a... [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=-E5thqW-tpc5lwf4NAk3nWIJuy1TuLiUgkcD1DXJLdXBENl79jdjYV8ECjBPA5otdRSNhTDoFm8]Newzed@a...[/url
Sent: Friday, December 12, 2003 9:17 AM
To: basicstamps@yahoogroups.com
Subject: Re: [noparse][[/noparse]basicstamps] Comment out a block of code?
In a message dated 12/12/2003 8:50:52 AM Eastern Standard Time,
jwilliams@p... writes:
> During the development of the latest compiler we discussed adding
> block comments -- but can find no references to block comments in any
> other version of BASIC. If, in fact, there is a form of BASIC that
> uses block comments please share so that we can examine the model.
>
Jon, I use both Basica and QBasic and the only comment control I have ever
seen is the REM command.
Sid
[noparse][[/noparse]Non-text portions of this message have been removed]
To UNSUBSCRIBE, just send mail to:
basicstamps-unsubscribe@yahoogroups.com
from the same email address that you subscribed. Text in the Subject and
Body of the message will be ignored.
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
Actually, most modern VB editors have a way you can select a bunch of code
and execute a "comment/uncomment block" command (maybe via a right click).
This just inserts or removes ' from the front of everything. The latest
MPLAB has this for assembly too (using ; of course).
Not to wish for editor bloat, but this would probably be a 10 minute thing
to add and probably has a lot of utility (Tracy's conditional compiling
trick notwithstanding).
Al Williams
AWC
* Simple RS232 Prototyping: http://www.al-williams.com/rs1.htm
>
Original Message
> From: Jon Williams [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=exWHA7CvPRuF2UFF0WCRphVPiboFgFLry4nCVhB37YAQ4mW92MM8DJAaw-6MbeWDA8eV1ln7dBAKFXW9hb8Adks]jwilliams@p...[/url
> Sent: Friday, December 12, 2003 7:45 AM
> To: basicstamps@yahoogroups.com
> Subject: RE: [noparse][[/noparse]basicstamps] Comment out a block of code?
>
>
> During the development of the latest compiler we discussed
> adding block comments -- but can find no references to block
> comments in any other version of BASIC. If, in fact, there
> is a form of BASIC that uses block comments please share so
> that we can examine the model.
>
> -- Jon Williams
> -- Applications Engineer, Parallax
> -- Dallas Office
>
>
>
Original Message
> From: laurasdog@w...
> [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=UGPg3p5cY6wuo1aaJTAlw0iRV3p3lRMr9caoW_o2ceY1VvfKTOmqi2lvC6flX8hhDpcU0LI980oMtcQZcaTpdQxSYO_Igw]laurasdog@w...[/url
> Sent: Thursday, December 11, 2003 5:05 PM
> To: basicstamps@yahoogroups.com
> Subject: [noparse][[/noparse]basicstamps] Comment out a block of code?
>
>
> Sorry in advance for the stupid question...
>
> Is it possible to "comment out" a whole block of
> code at once for testing, or do I have to do it
> 'one
> 'damned
> 'line
> 'at
> 'a
> 'time?
>
> Is kind of a pain to disable several dozen lines
> at once sometimes.
>
> Is there an easy way out?
>
> Thanks much!
>
> Steve D. - official newbie stamper
>
> ----
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the
> Subject and Body of the message will be ignored.
>
>
> Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
>
>
>
>
> This message has been scanned by WebShield. Please report
> SPAM to abuse@p....
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the
> Subject and Body of the message will be ignored.
>
>
> Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/
Looks like there's not a way to genuinely comment out
a whole block, but there seem to be plenty of workarounds...
I've done a small amount of work with ActionScript (Macromedia
Flash) and liked being able to EASILY comment a whole block.
Was hoping it was possible with PBasic too...
Oh well, back to cut and paste.
Thanks all!
Steve D. - Wannabe Stamper
-- Jon Williams
-- Parallax
Original Message
From: Al Williams
Sent: Friday, December 12, 2003 9:07 AM
To: basicstamps@yahoogroups.com
Subject: RE: [noparse][[/noparse]basicstamps] Comment out a block of code?
Hi Jon,
Actually, most modern VB editors have a way you can select a bunch of
code and execute a "comment/uncomment block" command (maybe via a right
click). This just inserts or removes ' from the front of everything. The
latest MPLAB has this for assembly too (using ; of course).
Not to wish for editor bloat, but this would probably be a 10 minute
thing to add and probably has a lot of utility (Tracy's conditional
compiling trick notwithstanding).
Al Williams
AWC
* Simple RS232 Prototyping: http://www.al-williams.com/rs1.htm
>
Original Message
> From: Jon Williams [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=tmMCyxXvyjGQ6ndV9eVbdY-IafYFdneI-GXPkuh5LzEbUM1KmiRCrPXf-2hZxMfVq8sfU5VXI1cg2qfQDSbKkA]jwilliams@p...[/url
> Sent: Friday, December 12, 2003 7:45 AM
> To: basicstamps@yahoogroups.com
> Subject: RE: [noparse][[/noparse]basicstamps] Comment out a block of code?
>
>
> During the development of the latest compiler we discussed
> adding block comments -- but can find no references to block
> comments in any other version of BASIC. If, in fact, there
> is a form of BASIC that uses block comments please share so
> that we can examine the model.
>
> -- Jon Williams
> -- Applications Engineer, Parallax
> -- Dallas Office
>
>
>
Original Message
> From: laurasdog@w...
> [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=8Ybz_TeDceSLvjujk_-Rvs6E90E8_Eo68ayo1ftONfcAklsoh3EICBTqrzJJXE3WFKcITmLL9-pD1gsv-znJbDiwJYcbPA]laurasdog@w...[/url
> Sent: Thursday, December 11, 2003 5:05 PM
> To: basicstamps@yahoogroups.com
> Subject: [noparse][[/noparse]basicstamps] Comment out a block of code?
>
>
> Sorry in advance for the stupid question...
>
> Is it possible to "comment out" a whole block of
> code at once for testing, or do I have to do it
> 'one
> 'damned
> 'line
> 'at
> 'a
> 'time?
>
> Is kind of a pain to disable several dozen lines
> at once sometimes.
>
> Is there an easy way out?
>
> Thanks much!
>
> Steve D. - official newbie stamper
>
> ----
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the
> Subject and Body of the message will be ignored.
>
>
> Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
>
>
>
>
> This message has been scanned by WebShield. Please report
> SPAM to abuse@p....
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the
> Subject and Body of the message will be ignored.
>
>
> Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/
To UNSUBSCRIBE, just send mail to:
basicstamps-unsubscribe@yahoogroups.com
from the same email address that you subscribed. Text in the Subject
and Body of the message will be ignored.
Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/
This message has been scanned by WebShield. Please report SPAM to
abuse@p....
If you type REM on a blank line in QBasic and press F1 on that line,
you should see that REM and ' are both valid for remarks.(see below)
+
HELP: REM Statement QuickSCREEN
¦+-
¦ QuickSCREEN Details Example Contents Index
¦
¦REM - a BASIC declaration that allows explanatory remarks to be
¦ inserted in a program
¦
¦Syntax
¦ REM remark
¦ ' remark
¦
¦ _ remark is any explanation you think will be useful to a reader of
¦ the program text, and which will fit on the rest of the program line
¦
¦See Also $STATIC and $DYNAMIC Metacommands $INCLUDE Metacommand
John W,
As far as looking for a model or structure, I would think that
something like...
NOTE
comments go here
even here there are comments
and yet again there are comments here as well
END NOTE
...would be trivial to implement.
-Beau Schwabe
>I use Turbo basic, and have used qbasic. I use ' for comments and it works
>fine<G>.
>
>
Original Message
>From: Newzed@a... [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=tToksYrDlpyZVBa4sWTVEaFgcRpR-KBsW6oo45HRMbfMAMXycUiiuogJWM7y7XJqSOkDGA8]Newzed@a...[/url
>Sent: Friday, December 12, 2003 9:17 AM
>To: basicstamps@yahoogroups.com
>Subject: Re: [noparse][[/noparse]basicstamps] Comment out a block of code?
>
>
>In a message dated 12/12/2003 8:50:52 AM Eastern Standard Time,
>jwilliams@p... writes:
>
>
> > During the development of the latest compiler we discussed adding
> > block comments -- but can find no references to block comments in any
> > other version of BASIC. If, in fact, there is a form of BASIC that
> > uses block comments please share so that we can examine the model.
> >
>
>Jon, I use both Basica and QBasic and the only comment control I have ever
>seen is the REM command.
>
>Sid
am used to compiling code up to about 10,000 lines. The #IFDEF is
unquestionably the way to go for that size of code.
I am a newbie to Stamps. Because I am currently doing a lot of
verification of my code, the #ifdef would be extremely handy.
Take care,
Frank
--- In basicstamps@yahoogroups.com, "S Parkis" <parkiss@e...> wrote:
> > ...Oh well, back to cut and paste.
>
> Huh? As one who begged for conditional complilation and was elated
> to see it in the new editor, I don't see that:
>
> #IF 0 #THEN
> ...
> #ENDIF
>
> is that much harder than C's:
>
> /*
> ...
> */
>
> Regards,
>
> Steve
Why not jump over?.....much less work, less chance of missing a line.
ken
Thanks to all who responded!
Looks like there's not a way to genuinely comment out
a whole block, but there seem to be plenty of workarounds...
I've done a small amount of work with ActionScript (Macromedia
Flash) and liked being able to EASILY comment a whole block.
Was hoping it was possible with PBasic too...
Oh well, back to cut and paste.
[noparse][[/noparse]Non-text portions of this message have been removed]
>Huh? As one who begged for conditional complilation and was elated
>to see it in the new editor, I don't see that:
>
>#IF 0 #THEN
>...
>#ENDIF
>
>is that much harder than C's:
>
>/*
>...
>*/
It's not that it's any harder, or doesn't work well...
It's just that I'm inexperienced and pretty clueless at this point.
I find the colored syntax to be a great help, and the green color
of commented code makes it easy for my brain to distinguish
code I can safely ignore. Cut and paste removes the "unused"
code entirely from the stage, so that's easy for me to deal with...
The
#IF 0 #THEN
#ENDIF
directive is very nice, it's just a little harder for my brain to
distinguish the "useful" from the "unused" that way when there's
a lot of lines of code.
I'm sure I'll be O.K. when I get a bit more experiance....
You folks are a great resource!
Steve D. - still tryin' to get a clue
block comments if the conditions fail.
On Fri, 12 Dec 2003, Jon Williams wrote:
> During the development of the latest compiler we discussed adding block
> comments -- but can find no references to block comments in any other
> version of BASIC. If, in fact, there is a form of BASIC that uses block
> comments please share so that we can examine the model.
>
> -- Jon Williams
> -- Applications Engineer, Parallax
> -- Dallas Office
>
>
>
Original Message
> From: laurasdog@w...
> [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=D48yLTU-cte1evVvYUi4F0S5N053eUiRLS5JDTJ-n2zZgfSIceaBXScebdUq8myuZJV7OdAfhjEDk8WDYYsQ3psvAZol]laurasdog@w...[/url
> Sent: Thursday, December 11, 2003 5:05 PM
> To: basicstamps@yahoogroups.com
> Subject: [noparse][[/noparse]basicstamps] Comment out a block of code?
>
>
> Sorry in advance for the stupid question...
>
> Is it possible to "comment out" a whole block of
> code at once for testing, or do I have to do it
> 'one
> 'damned
> 'line
> 'at
> 'a
> 'time?
>
> Is kind of a pain to disable several dozen lines
> at once sometimes.
>
> Is there an easy way out?
>
> Thanks much!
>
> Steve D. - official newbie stamper
>
> ----
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the Subject
> and Body of the message will be ignored.
>
>
> Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
>
>
>
>
> This message has been scanned by WebShield. Please report SPAM to
> abuse@p....
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the Subject and Body
of the message will be ignored.
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>
Sean T. Lamont, CTO / Chief NetNerd, Abstract Software, Inc. (ServNet)
Seattle - Bellingham - Vancouver - Portland - Everett - Tacoma - Bremerton
email: lamont@a... WWW: http://www.serv.net
"Do not fear mistakes, There Are None" - Miles Davis
--
Regards
Dave Evartt
American Hovercraft
Maybe I'll start doing this:
#DEFINE HideThis = 1
...
#IF HideThis #THEN
' ignore this code
#ENDIF
-- Jon Williams
-- Applications Engineer, Parallax
-- Dallas Office
Original Message
From: S Parkis [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=GBw-1VtiShloJbAxHmeog8JhHFYWsvztJ2Vax3SoJGxs8deldSIFvUUpMFkLLKpu_MQelTQDypHqK7rlg4Tcvw]parkiss@e...[/url
Sent: Friday, December 12, 2003 2:44 AM
To: basicstamps@yahoogroups.com
Subject: RE: [noparse][[/noparse]basicstamps] Comment out a block of code?
> ...Oh well, back to cut and paste.
Huh? As one who begged for conditional complilation and was elated
to see it in the new editor, I don't see that:
#IF 0 #THEN
...
#ENDIF
is that much harder than C's:
/*
...
*/
Regards,
Steve
To UNSUBSCRIBE, just send mail to:
basicstamps-unsubscribe@yahoogroups.com
from the same email address that you subscribed. Text in the Subject
and Body of the message will be ignored.
Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/
This message has been scanned by WebShield. Please report SPAM to
abuse@p....