Home > FAQ, Survey Logic > How To: Use basic scripting operators

How To: Use basic scripting operators

Overview

In order to script correctly, calculate and use functions with our complex scripting engine – basic knowledge of programming operators is needed.
The following ‘How To’ will summarize all the common used operators syntax and their truth tables.

Logic Operators:

‘AND’ Operator:
The ‘AND’ operator is represented as ‘&&’ in code and its truth table is the following:

A

B

A && B

FALSE

FALSE

FALSE

FALSE

TRUE

FALSE

TRUE

FALSE

FALSE

TRUE

TRUE

TRUE

‘OR’ Operator:

The ‘OR’ operator is represented as ‘||’ in code and its truth table is the following:

A

B

A || B

FALSE

FALSE

FALSE

FALSE

TRUE

TRUE

TRUE

FALSE

TRUE

TRUE

TRUE

TRUE

‘NOT’ Operator:

The ‘NOT’ operator is represented as ‘ ! ‘ in code and its truth table is the following:

A

!A

FALSE

TRUE

TRUE

FALSE

XOR’ Operator:

The ‘XOR’ operator is represented as ‘ ^ ‘ in code and its truth table is the following:

A

B

A ^ B

FALSE

FALSE

FALSE

FALSE

TRUE

TRUE

TRUE

FALSE

TRUE

TRUE

TRUE

FALSE


Mathematical Operators:

‘GREATER THAN’ Operator:

The ‘GREATER THAN’ operator is represented as ‘ > ‘ in code. (Return’s TRUE or FALSE)

‘GREATER THAN OR EQUALS TO’ Operator:

The ‘GREATER THAN OR EQUALS TO’ operator is represented as ‘ >=’ in code. (Return’s TRUE or FALSE)

‘SMALLER THAN’ Operator:

The ‘GREATER THAN’ operator is represented as ‘ < ‘ in code. (Return’s TRUE or FALSE)

‘SMALLER THAN OR EQUALS TO’ Operator:

The ‘GREATER THAN’ operator is represented as ‘ <= ‘ in code. (Return’s TRUE or FALSE)

‘EQUALS TO’ Operator:

The ‘EQUALS TO operator is represented as ‘ == ‘ in code. (Return’s TRUE or FALSE)
* Please note that using ‘=’ operator will assign the right value to the left and NOT check if they are equal.

‘NOT EQUALS TO’ Operator:

The ‘NOT EQUALS TO operator is represented as ‘ != ‘ in code. (Return’s TRUE or FALSE)

Mathematical methods:

‘+’ is used for adding.

‘-‘ is used for subtracting.

‘/’ is used for dividing. (Remnant is dismissed).

‘%’ is used for getting the remnant from dividing by ‘x’.
‘*’ is used for multiplying.

‘+=’ is used to do the following: ‘x += 2’ is a short way to write: ‘x = x + 2’. (the same for the rest of the operators).

This is a summary of most of the commonly used operators.

Visit us at: http://www.dooblo.net

Categories: FAQ, Survey Logic
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: