Boolean and Conditional Logic Functions

  • Updated

This page outlines boolean and conditional logic operations you can perform in NetScript.

if..then..else

This function defines a sequence of conditional statements. The result is defined by the first true conditional. The else value is optional, and the default result is null.

Function: if condition1 then result1 [else if condition2 then result2...] [else resultN] end

Data Type: input type

Example:

if 'test' == 'test' then true else if 'test2' == 'test2' then true else false end
if “test” == “test1” then “test1 success” else if “test2” == “test2” then “test 2 success” end
Result:
true
test 2 success

not (bool1)

This function returns the boolean negation of bool1.

Function: not (bool1)

Data Type: boolean

Example:

not ('a' == 'b')
not ('a' != 'b')
Result:
true
false

bool1 or bool2

This function returns whether bool1  or bool2  is true .

Function: bool1 or bool2

Data Type: boolean

Example:

'a' != 'b' or 'a' == 'b'
'a' == 'b' or 'a' == 'b'
Result:
true
false

bool1 and bool2

This function returns whether bool1  or bool2  is true .

Function: bool1 and bool2

Data Type: boolean

Example:

'a' == 'a' and 'b' == 'b'
'a' != 'b' and 'a' == 'b'
Result:
true
false

input1 == input2

This function returns whether input1 and input2 are equal.

Function: input1 == input2

Data Type: boolean

Example:

'snow' == 'snow'
'snow' == 'food'
Result:
true
false

input1 != input2

This function returns whether input1 and input2 are unequal.

Function: input1 != input2

Data Type: boolean

Example:

'snow' != 'food'
'snow' != 'snow'
Result:
true
false

input1 < input2

This function returns whether the value of input1 is less than input2.

Function: input1 < input2

Data Type: boolean

Example:

57 < 65
65 < 57
Result:
true
false

input1 > input2 

This function returns whether the value of input1  is greater than input2 .

Function: input1 > input2

Data Type: boolean

Example:

52 > 43
43 > 52
Result:
true
false

input1 <= input2

This function returns whether the value of input1 is less than or equal to input2.

Function: input1 <= input2

Data Type: boolean

Example:

18 <= 19
19 <= 18
Result:
true
false

input1 >= input2

This function returns whether the value of input1 is greater than or equal to input2..

Function: input1 >= input2

Data Type: boolean

Example:

74 >= 23
23 >= 74
Result:
true
false

is_null(input)

This function returns whether the input  is null. The input can be any value.

Function: is_null(input)

Data Type: boolean

Example:

is_null(null)
is_null(6)
Result:
true
false

anything in all_values

This function returns whether the value <anything> is found in the collection all_values .

Function: <anything> in all_values

Data Type: boolean

Example:

1 in ["1","2","3","4"]
0 in ["1","2","3","4"]
Result:
true
false

anything == all_values

This function returns whether two collections contain the same values and in the same order.

Function: <anything> == all_values

Data Type: boolean

Example:

["1", "2", "3", "4"] == ["1", "2", "3", "4"]
["0"] == ["1", "2", "3", "4"]
Result:
true
false