How to comment out a block of code?

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller

Post Reply
derek
Posts: 17
Joined: Tue Oct 17, 2006 9:39 pm
Location: New Mexico

How to comment out a block of code?

Post by derek » Wed Jul 11, 2007 12:19 am

In debugging or modifying scripts, it is often useful to "comment out" a block of code, so that it will be ignored (treated as a comment) until I decide to reactivate it. I know that I can turn any single line of code into a comment, by adding -- (double dash) at the beginning. However, this is tedious and error-prone, if I want to comment out twenty or thirty lines of a script at a time.

Is there a simple way to mark a block of code, so that it will be treated as a comment?

Thanks,

Derek
Derek Roff
Language Learning Center
University of New Mexico

Lynn P.
Posts: 79
Joined: Sun Apr 09, 2006 1:09 pm

Post by Lynn P. » Wed Jul 11, 2007 12:37 am

Hi Derek ~

Here are a couple of ways...
In the script editor, drag and select the lines you want to comment out temporarily, then choose "Comment" from the Script menu.

Or...

You can put /* at the start of the section of code and */ at the end.

Lynn P.

derek
Posts: 17
Joined: Tue Oct 17, 2006 9:39 pm
Location: New Mexico

Post by derek » Wed Jul 11, 2007 12:46 am

Thank you, Lynn. This is just what I was looking for.

Derek
Derek Roff
Language Learning Center
University of New Mexico

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”