Jump to content

BSL:Manual: Difference between revisions

m
more wording
m (wording improvements)
m (more wording)
Line 241: Line 241:
|}
|}


Note that "=" is '''not''' for checking if one entity is equal to another (see "eq" below for that).
Note that "=" is '''not''' for checking if one entity is equal to another (see "eq" under {{SectionLink||Relational}} for that).


===Arithmetical===
===Arithmetical===
Line 282: Line 282:
  }
  }


Alternatively, you can use the sum operator, which doesn't suffer from this issue:
Alternatively you can use the sum operator, which doesn't suffer from this issue:


  if (5+-6 eq -1)
  if (5+-6 eq -1)
Line 303: Line 303:
| eq
| eq
| Equal to
| Equal to
| Tests if two values are equal. (== does not work)
| Tests if two values are equal.
|-
|-
| ne
| ne
| Not equal to
| Not equal to
| Tests if two values are different. (!= does not work)
| Tests if two values are different.
|-
|-
| >
| >
Line 336: Line 336:
| !
| !
| Not
| Not
| Logical Not. Reverses the result of a test. "!(some_bool eq true)" is the same as saying "some_bool eq false" or "some_bool ne true".
| Logical Not. Reverses the result of a test.
|-
|-
| and
| and
Line 347: Line 347:
|}
|}


See {{SectionLink||if}} to learn how to use the logical operators.
To elaborate on the purpose of '!' meaning "not", the following three lines are equivalent:
!(some_bool eq true)
some_bool eq false
some_bool ne true
 
See {{SectionLink||if}} for detailed examples of using the logical operators.


==Reserved words==
==Reserved words==
Line 358: Line 363:
  '''var''' int a = 0;
  '''var''' int a = 0;


After this, you can refer to the variable merely as "a". See {{SectionLink||Variables}} for details on declaring variables.
After this, you refer to the variable merely as "a". See {{SectionLink||Variables}} for details on declaring variables.


====func====
====func====
Line 366: Line 371:
  }
  }


Besides this, you can call the function merely by writing "spawn_team", but the proper new-style syntax is "spawn_team();". See {{SectionLink||Functions}} for details on declaring functions.
After this, you call the function merely by writing its name; "spawn_team" would work, but the proper new-style syntax is "spawn_team();". See {{SectionLink||Functions}} for details on declaring functions.


===Type specification===
===Type specification===