This course is currently a work in progress. Please join the waitlist to receive regular updates.

Math operators in apex

To manipulate numeric data, apex supports math operators. Following are the math operators in apex:

  • Addition (+): Adds two numbers together.
  • Subtraction (-): Subtracts the second number from the first.
  • Multiplication (*): Multiplies two numbers.
  • Division (/): Divides the first number by the second.

Apart from math operators, apex provides a set of math functions which can be used to perform math operations

The following code snippet shows how to add two numbers in apex.

Loading...

In the above example:

  • The variables numb1, numb2 areInteger variables.
  • The variable sum store the sum of numb1, numb2.

Try It Yourself

Loading...