The addition, subtraction, multiplication, division, and modulus operators can only be used with numeric values. The arithmetic operators are described in Arithmetic operators.

Operator |
Description |
---|---|

+ |
Addition |

- |
Subtraction |

* |
Multiplication |

/ |
Division |

% |
Modulus |

Note:

You can isolate the decimal portion of a number with the modulus operator by using the syntax: number%1.

For example, this script assigns numeric values to two variables. These numbers are used in addition, subtraction, multiplication, division, and modulus operations.

ASL Script (mathematic_do.asl): START do { a = 36; b = 4; print(“Addition “.a+b); c = a-b; print(“Subtraction “.c); d = a*b; print(“Multiplication “.d); print(“Division “.b/a); e = 10%b; print("Modulus ".e); stop(); } Output: $ sm_adapter mathematic_do.asl Addition 40 Subtraction 32 Multiplication 144 Division 0.111111111111111 Modulus 2 $