Comments and Flags

Welcome to the final page of this guide! Let's talk about comments and flags.

Comments

Comments represent text meant for the viewer of the code. Comments can be used to explain a certain piece of code, show credits, add notes, etc. Comments are ignored by the compiler, therefore they do not have any kind of influence on your script.

Here's an example of a comment followed by a variable definition:

-- This is a comment
thisIsAVariable = true

As you can see, comments start with -- and contain text that's meant for a human. A single comment occupies a single line.

There are two rules for defining comments in Powerlang:

  • The comment must begin with -- (there must be a space after --)

  • The comment must not be at the last line of the script

It is possible to make multi-line comments by combining multiple comments:

-- Comment 1
-- Comment 2
-- Comment 3
thisIsAVariable = true

Flags

Flags tell the compiler how your code should be processed. Just like comments, flags don't directly influence your code's structure, however they have an effect on the code's compilation.

For example, you may observe that by default, a "watermark" block gets added to all compiled scripts:

But you can define the DoNotIncludeWatermark flag to omit it. Here's how a flag is defined:

@flag DoNotIncludeWatermark
-- your code here...

Now when you compile the script, you will notice that the watermark is gone:

But your code still runs the same way it did before.

As of right now, 6 (but only 2 usable) flags are available:

Although the current amount of available flags is little, more will be added as Powerlang evolves.


You finished the Powerlang Beginner's Guide. Now you are (hopefully) ready to make your own games and programs of interest!

Be sure to check out the Potato Rush demo game project to see your skill in practice.

Or if you feel confident enough, check out the documentation.

Last updated