PascalSyntax.wiki
author Wuzzy <almikes@aol.com>
Wed, 19 Apr 2017 16:41:16 +0200
changeset 977 2269c95056fe
child 979 1455b4ad1ec3
permissions -rw-r--r--
Add HW-specific rules for Pascal code

#summary Pascal syntax rules

When programming in Pascal for Hedgewars, we have two rules which must be
always obeyed. This is because of our tool `pas2c` which doesn't fully
understand Pascal yet. If these rules are broken, `pas2c` will fail to
operate.

== Two Pascal rules for pas2C ==

 # Never use `not` without brackets
 # Never use `in` with numerals

=== Examples ===

Forbidden:

`if a in [1, 2] then`

Allowed:

`if a in [sprBubble, sprAmGirder] then`

Forbidden:

`if not isExploded then`

Allowed:

`if not (isExploded) then`

Allowed

`if isExploded <> true then`