GLBasic forum

Main forum => GLBasic - en => Topic started by: msx on 2011-Jan-31

Title: comment several lines of code
Post by: msx on 2011-Jan-31
Is there a way to comment several lines of  code using / * xxxx  * / as in C language? If that can be added for me would be helpful.
Title: Re: comment several lines of code
Post by: MrTAToad on 2011-Jan-31
At the moment, the only way is either manually adding // or highlighting a block and selecting Edit -> Toggle Block Comment
Title: Re: comment several lines of code
Post by: Hemlos on 2011-Jan-31
This is how you can fix an entire document:

On the menu bar at top of the IDE:
click "edit", and "select all", then click edit once more and click "replace"

A window will open for replacing words...
In the top edit box, type "/*"
In the bottom edit, type "//"
And finally click the button that says "Replace".

Your entire document will have all the "/*" entries replaced with "//"


Title: Re: comment several lines of code
Post by: Ian Price on 2011-Jan-31
Or you can highlight your block of text and use CTR+K. This acts as a toggle too.
Title: Re: comment several lines of code
Post by: msx on 2011-Jan-31
Quote from: Ian Price on 2011-Jan-31
Or you can highlight your block of text and use CTR+K. This acts as a toggle too.

Perfect!  :nw:
Title: Re: comment several lines of code
Post by: Jonás Perusquía on 2013-Mar-28
Quote from: msx on 2011-Jan-31
Quote from: Ian Price on 2011-Jan-31
Or you can highlight your block of text and use CTR+K. This acts as a toggle too.

Perfect!  :nw:
Perfect!  :nw:
Title: Re: comment several lines of code
Post by: spicypixel on 2013-Mar-29
Quote from: Ian Price on 2011-Jan-31
Or you can highlight your block of text and use CTR+K. This acts as a toggle too.

Just make sure the top line that you comment out in the block isn't already commented out otherwise it screws up.
Title: Re: comment several lines of code
Post by: sf-in-sf on 2013-Oct-17
There is also this useful way: use the pre-processor.

?IFDEF TESTING_CONDITION // or silly name
  //Plenty of dodgy code
  // that you don't want.
?ENDIF

To enable the code, write at the very top:
?DEFINE TESTING_CONDITION

Like this it's easy to switch from old to new version of a snippet, and vice-versa:

?IFDEF NEWVERSION
   //new code here.
?ELSE
   //old code here
?ENDIF
Title: Re: comment several lines of code
Post by: mentalthink on 2013-Oct-18
CTRL+K I think it's better then /* and */ in C++ this it's really quick select a lof of lines and press the command...

Title: Re: comment several lines of code
Post by: r0ber7 on 2013-Oct-18
Quote from: spicypixel on 2013-Mar-29
Just make sure the top line that you comment out in the block isn't already commented out otherwise it screws up.

Ah, so that's it. That has been annoying me. I still think adding /**/ would be a good idea though, for those of us working without the GLBasic IDE sometimes.
Title: Re: comment several lines of code
Post by: Schranz0r on 2013-Oct-18
/* blablabla */


i like the idea!
Pls post a request!
Title: Re: comment several lines of code
Post by: Kitty Hello on 2013-Oct-19
I do
?IF 0
...
?ENDIF


Sent from my GT-N7100 using Tapatalk

Title: Re: comment several lines of code
Post by: spicypixel on 2013-Oct-19
/*



*/

Is perfect for the PHP guys amongst us :D +1 for meee.

Title: Re: comment several lines of code
Post by: Schranz0r on 2013-Oct-20
+1