473,803 Members | 2,599 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to comment out a block of code

is there a syntax to comment out a block of code? i.e. like html's <!--
comment -->
or perhaps put a marker so that all lines from there on are ignored?
thanks.

Xah
xa*@xahlee.org
http://xahlee.org/PageTwo_dir/more.html

Jul 18 '05 #1
3 19504
A bit of a hack of course, but you can enclose the code that should be
commented out with ''' and ''' or """ and """ (not sure about the name of
this tripple-quoting)
OTOH, some (or even most if not all) Python editors support blockquoting
by pushing a button or using shortcuts. SPE and IDLE for example.

Jul 18 '05 #2
Xah Lee wrote:

is there a syntax to comment out a block of code? i.e. like html's <!--
comment -->
or perhaps put a marker so that all lines from there on are ignored?
thanks.


The simplest way is to select the block of code in your editor and use the
'comment-region' command. If this doesn't work, upgrade your editor.

Most editors have a command to do this although obviously the name will
vary slightly: Idle calls it 'Comment Out Region', SciTe calls it 'Block
Comment', emacs calls it 'comment-region'.
Jul 18 '05 #3
Xah Lee wrote:
is there a syntax to comment out a block of code? i.e. like html's <!--
comment -->
or perhaps put a marker so that all lines from there on are ignored?
thanks.


Of course -- this feature is so important that all computer
manufacturers worldwide have made a special button on the computer
case just for this!

Normally it's a large round button, with perhaps a green backlight.
Press the button and hold it in for about 3 seconds, and the rest of
your code/writing will be ignored just as it should be.

Jeff Shannon
Technician/Programmer
Credit International

Jul 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
18800
by: Rob | last post by:
Hello all, If I have the following code fragment: /* comment bla bla */ ....code... With a regular expression, how do I get/extract the comment inside this multi line comment block. With and without the comment characters?
4
5447
by: Matthew Louden | last post by:
I want to know what's the convenient way to comment out a block in ASP pages? I read a book, and I thought we can use /** */ to comment out the VBScript in ASP page, but it yields run time error. All I know is to use ' but this is very slow if I want to comment out a block? Any suggestions??
1
1646
by: David Veeneman | last post by:
In VS.NET 1.1, when I commented-out a block of code, VS.NET put the comment slashes on the left margin, rather than next to the code. This made it very easy to identify blocks of code that I had commented out. VS.NET 2.0 puts the slashes next to the code, which I find far less convenient. But I can't find a user option to move block-comment slashes back to the left margin. Does anyone know if there is a way to do this? Thanks.
19
2213
by: diffuser78 | last post by:
Like in C we comment like /* Bunch of lines of code */ Should we use docstring """ """ Or there is something else too ?? Every help is appreciated.
6
2427
by: cdrsir | last post by:
we can use 1) // my comments a 2) /* my comments b */ when we want to add some comments. I know some compilers just support the 2nd syntax, but normally both of these 2 syntaxs are supported by most of the compilers. But what are the difference for those two syntaxs in the sense for the compiler, if it support both. Is one of them will be processed faster?
29
2377
by: dbhbarton | last post by:
Had a thought that's grown on me. No idea if it's original or not- too inexperienced in programming- but I guess there's no harm floating it out there. Python wins big on readability, and there's no doubt that context- dependent text formatting in IDEs (keywords, strings, comments etc) is a massive help too, therefore benefitting development and maintenance. This idea is in a similar vein, especially for when scripts grow large.
14
3076
by: Siv | last post by:
Hi, Just busily coding away and removed a procedure from my code and all of a sudden an error came up miles away from the location of the piece of code I removed and it relates to the XML comment inserted at the top of the procedure. I had this happen once before and I couldn't fathom why it was complaining, the XML comment is like this:
39
2890
by: polas | last post by:
Afternoon all. I was just wondering about this point - I have (generally) used // for commenting a single line in C, but from looking at code other people have written it seems many use /* */ (which I only use if my comment will be over multiple lines) - does one way have any advantages over the other, or is the style exactly that, a question of style? Cheers, Nick
3
10857
by: Richard | last post by:
Again, new to DB2. Trying to do something I can do in Sybase ASE. In any Sybase SQL script I can use /* */ to comment out a block of code. In the DB2 9.0 SQL Reference Manual V1 it says: Comments: SQL comments are either bracketed (introduced by /* and end with */) or simple (introduced by two consecutive hyphens and end with
0
9699
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
10289
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9119
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7600
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6840
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5496
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5625
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4274
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2968
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.