Comment

Just starting out? Need help? Post your questions and find answers here.
User avatar
rndrei
Enthusiast
Enthusiast
Posts: 153
Joined: Thu Dec 28, 2023 9:04 pm

Comment

Post by rndrei »

How to make a large piece of code comment?
BarryG
Addict
Addict
Posts: 4173
Joined: Thu Apr 18, 2019 8:17 am

Re: Comment

Post by BarryG »

Select it and press Ctrl+B. To uncomment, select it and press Shift+Ctrl+B.

Or, wrap it with "CompilerIf 0" and "CompilerEndIf" like this:

Code: Select all

CompilerIf 0
  a$="Hello"+#CRLF$
  a$+"there"
  MessageRequester("This block is ignored",a$)
CompilerEndIf
Last edited by BarryG on Tue Apr 15, 2025 9:59 pm, edited 1 time in total.
Marc56us
Addict
Addict
Posts: 1600
Joined: Sat Feb 08, 2014 3:26 pm

Re: Comment

Post by Marc56us »

...and to make it foldable, prefix and suffix the first and last lines with ;{ and ;}

Code: Select all

;{ Here a big comment (Unfold to read in full)
; bla
; bla
; bla
;}
AZJIO
Addict
Addict
Posts: 2191
Joined: Sun May 14, 2017 1:48 am

Re: Comment

Post by AZJIO »

BarryG wrote: Tue Apr 15, 2025 8:22 am

Code: Select all

CompilerIf 0
  a$="Hello"+#crlf
  a$+"there"
  MessageRequester("This block is ignored",a$)
CompilerEndIf
This is a great imitation when you want to disable part of the code, but at the same time it remains readable. I think it would be possible to add special tags CommStart - CommEnd or ;cs ;ce
Marc56us wrote: Tue Apr 15, 2025 8:44 am

Code: Select all

;{ Here a big comment (Unfold to read in full)
; bla
; bla
; bla
;}
This method has problems: if you perform "Code Formatting", the indentation disappears and the code becomes almost unreadable.
Marc56us
Addict
Addict
Posts: 1600
Joined: Sat Feb 08, 2014 3:26 pm

Re: Comment

Post by Marc56us »

AZJIO wrote: Tue Apr 15, 2025 2:41 pm
Marc56us wrote: Tue Apr 15, 2025 8:44 am

Code: Select all

;{ Here a big comment (Unfold to read in full)
; bla
; bla
; bla
;}
This method has problems: if you perform "Code Formatting", the indentation disappears and the code becomes almost unreadable.
Hi,

By "Code Formatting", you mean Ctrl + i ?
If Yes, I never have problem, indentation remain OK
(Windows version)
AZJIO
Addict
Addict
Posts: 2191
Joined: Sun May 14, 2017 1:48 am

Re: Comment

Post by AZJIO »

Marc56us wrote: Wed Apr 16, 2025 12:22 pm If Yes, I never have problem, indentation remain OK
This is only my problem, since I use my tool to correct indentation
Quin
Addict
Addict
Posts: 1133
Joined: Thu Mar 31, 2022 7:03 pm
Location: Colorado, United States
Contact:

Re: Comment

Post by Quin »

The only time I've seen the auto-indent in the IDE seriously screw up indentation of comments is if you have a comment after something like a global variable, then another comment on the line under it. It will try to align your comment with the first one :twisted:
Post Reply