Formula Explanation Example Formula Example Explanation
+ (Addition) Adds two numbers or concatenates strings. 3 + 5 Adds 3 and 5 to get 8.
- (Subtraction) Subtracts one number from another. 10 - 4 Subtracts 4 from 10 to get 6.
* (Multiplication) Multiplies two numbers together. 6 * 7 Multiplies 6 and 7 to get 42.
/ (Division) Divides one number by another. 20 / 4 Divides 20 by 4 to get 5.
% (Modulo) Finds the remainder after division of one number by another. 10 % 3 Finds the remainder of 10 divided by 3, which is 1.
^ (Exponentiation) Raises a number to the power of another number. 2 ^ 3 Raises 2 to the power of 3 to get 8.
== (Equal) Checks if two values are equal, returning true or false. 3 == 3 Checks if 3 equals 3, which is true.
!= (Not Equal) Checks if two values are not equal, returning true or false. 3 != 4 Checks if 3 does not equal 4, which is true.
> (Greater Than) Checks if one value is greater than another. 5 > 3 Checks if 5 is greater than 3, which is true.
< (Less Than) Checks if one value is less than another. 2 < 4 Checks if 2 is less than 4, which is true.
if() Executes conditional logic based on a specified condition. if(3 > 2, "Yes", "No") If 3 is greater than 2, returns "Yes"; otherwise, "No".
round() Rounds a number to the nearest integer or specified decimal places. round(2.67) Rounds 2.67 to the nearest whole number, which is 3.
abs() Returns the absolute value of a number. abs(-5) Returns the absolute value of -5, which is 5.
ceil() Rounds a number up to the nearest integer. ceil(2.3) Rounds 2.3 up to the nearest whole number, which is 3.
floor() Rounds a number down to the nearest integer. floor(2.7) Rounds 2.7 down to the nearest whole number, which is 2.
exp() Calculates the exponent of e to the power of the given number. exp(1) Calculates e^1, which is approximately 2.71828.
log() Calculates the natural logarithm of a number. log(e) Calculates the natural log of e, which is 1.
max() Returns the maximum value among the provided numbers. max(3, 7, 2) Returns the maximum value, which is 7.
min() Returns the minimum value among the provided numbers. min(3, 7, 2) Returns the minimum value, which is 2.
rand() Generates a random number between 0 and 1. rand() Generates a random number between 0 and 1.
sqrt() Calculates the square root of a number. sqrt(16) Calculates the square root of 16, which is 4.