Skip to main content

Operators

Learn about all the equations you can form.

There are set of valid operations that you can use with each data type. Some of which are unary operations, i.e. require one parameter, and others are binary operations, i.e. require two parameters.

Number Operations

Binary Operations

OperationNameFunctionReturn TypeExample
+AdditionAdds two numbers and returns the resultNumber
 الأول + الثاني
-SubtractionSubtract two numbers and returns the resultNumber
 الأول - الثاني
*MultiplicationMultiplies two numbers and returns the resultNumber
 الأول * الثاني
\ DivisionDivides two numbers and returns the resultNumber
 الأول \ الثاني
%ModuloDivides two numbers and returns the remainderNumber
 الأول % الثاني

Binary Logical Operations

OperationNameFunctionReturn TypeExample
>Greater ThanChecks if the first number is greater than the second and returns the resultBoolean
 الأول > الثاني
<Less ThanChecks if the first number is less than the second and returns the resultBoolean
 الأول < الثاني
>=Greater Than or EqualChecks if the first number is greater than or equal to the second and returns the resultBoolean
الأول >= الثاني
<=Less Than or EqualChecks if the first number is less than or equal to the second and returns the resultBoolean
الأول <= الثاني
==EqualChecks if the first number is equal to the second and returns the resultBoolean
الأول == الثاني
!=Not EqualChecks if the first number is not equal to the second and returns the resultBoolean
الأول != الثاني

Binary Assignment Operations

OperationNameFunctionReturn TypeExample
+=Add and AssignAdds a number to the original one and returns the new resultNumber
عداد += 3
-=Subtract and AssignSubtracts a number from the original one and returns the new resultNumber
عداد -= 3
*=Multiply and AssignMultiplies a number to the original one and returns the new resultNumber
عداد *= 3
\=Divide and AssignDivides by a number the original one and returns the new resultNumber
عداد \= 3

Unary Operations

OperationNameFunctionReturn TypeExample
-NegativeReturns the value of a number multiplied by -1Number
عدد-

Postfix Operations

OperationNameFunctionReturn TypeExample
++Addition PostfixAdds 1 to the number and returns the old valueNumber
++عداد
--Subtraction PostfixSubtracts 1 from the number and returns the old valueNumber
--عداد

Prefix Operations

OperationNameFunctionReturn TypeExample
++Addition PrefixAdds 1 to the number and returns the new valueNumber
عداد++
--Subtraction PrefixSubtracts 1 from the number and returns the new valueNumber
عداد--

Boolean Operations

Binary Operations

OperationNameFunctionReturn TypeExample
&&ANDReturns true if the conditions are true, false otherwiseBoolean
 الأول && الثاني
||ORReturns true if the any of the conditions is true, false otherwiseBoolean
 الأول  || الثاني
==EqualReturns true if the conditions are equal, false otherwiseBoolean
 الأول == الثاني
!=Not EqualReturns false if the conditions are equal, true otherwiseBoolean
 الأول != الثاني

Unary Operations

OperationNameFunctionReturn TypeExample
!NOTReturns true if the condition is false, false otherwiseBoolean
شرط!

String Operations

Binary Operations

OperationNameFunctionReturn TypeExample
+ConcatenationAdds two strings or a string and a number together and returns the resultString
"مرحبا" + " بالعالم"
الجواب هو :" + 10"
==EqualReturns true if the strings are equal, false otherwiseBoolean
 الأول == الثاني
!=Not EqualReturns false if the strings are equal, true otherwiseBoolean
 الأول == الثاني

Binary Assignment Operations

OperationNameFunctionReturn TypeExample
+=ConcatenateConcatenates a number or a string to the original one and returns the resultString
"رسالة += "مرحبا
*=RepeatRepeats the target string N times, updating it with the new value, and returning the resultString
رسالة *= 2