Comments

Comments in LiveCode are simliar to those in other languages. They serve as a note to you or others and are not output along with the rest of you scripts.

Single line comments

LiveCode has 3 different types so single line comments. Everything after the start of the comment until the end of the line is ignored.

  • #
  • //

e.g. LiveCode code:

<?lc
 put "Hello World!" // outputs hellow world
 # This is a comment
 -- this is also a comment
 ?>

outputs:

Hello World!
 Multy line comments

Multy line comments are usefull when you wanting to write a long comments that will span mulitple lines. LiveCode’s multy line comment is the same as in PHP. The comment starts with /* and ends with */.

e.g. LiveCode code:

<?lc
 put "Hello World!"
 /* The above outputs
 "Hello World */
 ?>

outputs:

Hello World!
 Using Comments

Using Comments

One of the biggest problems with comments, is that programmers fail to use them. Your code might make sense to you now, what about in a week, a month, a year? You don’t need to comment on every line of code you write, but using a quick comment to explain your logic or when writing a complicated function can go a long way to helping you in the future.

Leave a Reply