/library

Sentient Lang.

Boolean methods

Booleans are one of three types in the Sentient programming language. This document contains a reference of all boolean operators and methods.

&& (operator)

Logical AND.

true && true      #=> true
true && false     #=> false
false && true     #=> false
false && false    #=> false
|| (operator)

Logical OR.

true || true      #=> true
true || false     #=> true
false || true     #=> true
false || false    #=> false
== (operator)

Returns true if the boolean on the left is equal to the right.

true == true      #=> true
true == false     #=> false
false == true     #=> false
false == false    #=> true
!= (operator)

Returns true if the boolean on the left is not equal to the right.

true != true      #=> false
true != false     #=> true
false != true     #=> true
false != false    #=> false
!@ (operator)

Performs unary negation.

!true     #=> false
!false    #=> true
?: (operator)

Ternary conditional, see if.

true ? 5 : 3     #=> 5
false ? 5 : 3    #=> 3
if

Returns the value on the left if the conditional is true and the value on the right if the conditional is false.

true.if(5, 3)     #=> 5
false.if(5, 3)    #=> 3

Both the left and right expressions must be provided and will be evaluated, irrespective of the condition.

self

Returns the boolean.

true.self
#=> true