- This wiki is out of date, use the continuation of this wiki instead
Operators
From FenixWiki
(Difference between revisions)
Revision as of 12:49, 8 March 2008 (edit) Sandman (Talk | contribs) (→Example) ← Previous diff |
Revision as of 13:55, 19 May 2008 (edit) (undo) Sandman (Talk | contribs) m (→General) Next diff → |
||
Line 7: | Line 7: | ||
|- | |- | ||
| Type || - Get the [[ProcessTypeID]] of a [[ProcessType]] or define a new [[datatype]]. See [[Type]]. | | Type || - Get the [[ProcessTypeID]] of a [[ProcessType]] or define a new [[datatype]]. See [[Type]]. | ||
+ | |- | ||
+ | | . || - Element access. <code><struct>.<element></code>. In case of a struct array, if no arrayelement is specified, it points to [0] (see [[#example|example]]). | ||
|} | |} | ||
Revision as of 13:55, 19 May 2008
Contents |
List of Operators
General
Operator | - Description |
Type | - Get the ProcessTypeID of a ProcessType or define a new datatype. See Type. |
. | - Element access. <struct>.<element> . In case of a struct array, if no arrayelement is specified, it points to [0] (see example).
|
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
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; End Process Main() 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:
|