Kray3 SDK/Arithmetic operations

From Kray
Jump to: navigation, search

Arithmetic operations

Several standard arithmetic operations can be used inside Kray script.


You can perform ADD operation on doubles, strings and vectors.

<include highlight="kray3" src="/pub/kray3_script/operators/operators1.kray"></include>{{#ifeq: 1|1|

Run in KrayLive|}}


You can perform SUBTRACT operation on doubles and vectors.

<include highlight="kray3" src="/pub/kray3_script/operators/operators2.kray"></include>{{#ifeq: 1|1|

Run in KrayLive|}}

Unary -

Unary operations can also be performed on doubles and vectors.

<include highlight="kray3" src="/pub/kray3_script/operators/operators3.kray"></include>{{#ifeq: 1|1|

Run in KrayLive|}}


Can be performed on double, axes*axes, vector*axes, vector*vector.

<include highlight="kray3" src="/pub/kray3_script/operators/operators4.kray"></include>{{#ifeq: 1|1|

Run in KrayLive|}}


Can be performed on double, axes/axes, vector/axes, vector/vector.

<include highlight="kray3" src="/pub/kray3_script/operators/operators5.kray"></include>{{#ifeq: 1|1|

Run in KrayLive|}}


Modulo (%) can be performed on doubles.

<include highlight="kray3" src="/pub/kray3_script/operators/operators6.kray"></include>{{#ifeq: 1|1|

Run in KrayLive|}}


^ to the power of operator works on doubles.

<include highlight="kray3" src="/pub/kray3_script/operators/operators7.kray"></include>{{#ifeq: 1|1|

Run in KrayLive|}}


You can use comparision operators < > <= >= on doubles, strings.

<include highlight="kray3" src="/pub/kray3_script/operators/operators8.kray"></include>{{#ifeq: 1|1|

Run in KrayLive|}}

You can use comparision operators == != on doubles, strings, vectors and axes.

<include highlight="kray3" src="/pub/kray3_script/operators/operators9.kray"></include>{{#ifeq: 1|1|

Run in KrayLive|}}

Logic operators

And (&) Or (|), Not (!) logic operators can be used on doubles.

<include highlight="kray3" src="/pub/kray3_script/operators/operators10.kray"></include>{{#ifeq: 1|1|

Run in KrayLive|}}


Concatenation operators work on doubles, vectors, strings.

<include highlight="kray3" src="/pub/kray3_script/operators/operators11.kray"></include>{{#ifeq: 1|1|

Run in KrayLive|}}

Convert vector>axis

<> converts vector to axis.

<include highlight="kray3" src="/pub/kray3_script/operators/operators12.kray"></include>{{#ifeq: 1|1|

Run in KrayLive|}}

Exponential operator

E - exponential operator.

Concatenation operators work on doubles, vectors, strings.

<include highlight="kray3" src="/pub/kray3_script/operators/operators13.kray"></include>{{#ifeq: 1|1|

Run in KrayLive|}}