- This wiki is out of date, use the continuation of this wiki instead
Operators
From FenixWiki
(Difference between revisions)
Revision as of 12:12, 14 November 2007 (edit) Sandman (Talk | contribs) m (→General) ← Previous diff |
Revision as of 12:46, 14 November 2007 (edit) (undo) Sandman (Talk | contribs) m (→General) Next diff → |
||
Line 6: | Line 6: | ||
| ''Operator'' || - ''Description'' | | ''Operator'' || - ''Description'' | ||
|- | |- | ||
- | | | + | | Type || - Get the [[ProcessTypeID]] of a [[ProcessType]] or define a new [[datatype]]. See [[Type]] |
|} | |} | ||
Revision as of 12:46, 14 November 2007
Contents |
List of Operators
General
Operator | - Description |
Type | - Get the ProcessTypeID of a ProcessType or define a new datatype. See Type |
Maths
Operator | - Description |
+ | - Addition. |
- | - Deduction |
* | - Multiplication. |
/ | - Division. |
Logic
Operator | - Description |
|| | - OR. One or the other or both. |
&& | - AND. Both. |
^^ | - XOR. One or the other, but not both. |
! | - NOT. |
Bitwise
(Logical operation per bit.)
Operator | - Description |
| | - BOR. One or the other or both. |
& | - BAND. Both. |
^ | - BXOR. One or the other, but not both. |
~ | - BNOT. |
Memory
Operator | - Description |
& | - OFFSET. Get the memory address of a variable. See pointer. |
* | - POINTER. Get access to the variable a pointer is pointing to. See pointer. |
Example
Program operators; Global int int_1 = 1; int int_3 = 3; int int_4 = 4; int someint = -5; String somestring = "AAP"; String anotherstring = "BEER"; byte somebyte = 6; signed byte sbyte = -2; byte b_5 = 5; byte b_12 = 12; Begin say("---------- maths"); say(int_3 + int_4); say(int_3 * int_4 + 1); say("---------- strings with numerical datatypes"); say(somestring + anotherstring); say(somestring + ": " + int_3); say(anotherstring + ": " + int_3*sbyte); say("---------- mixed numberical types and typecasting"); say(somebyte+someint); say((signed byte)someint); say((unsigned byte)someint); say("---------- logic"); say(int_1&&int_4); say(int_4==int_3+int_1); say(!(somestring==anotherstring)); say("---------- bitwise"); say(b_5|b_12); // 00000101 // 00001100 // -------- | // 00001101 = 13 say(b_5&b_12); // 00000101 // 00001100 // -------- & // 00000100 = 4 say(b_5^b_12); // 00000101 // 00001100 // -------- ^ // 00001001 = 9 say(~b_12); // 00001100 // -------- ~ // 11110011 = 243 Repeat frame; Until(key(_esc)) End
Used in example: say()
This will result in something like: