Skip to end of banner
Go to start of banner

Arithmetic Operators

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this content. View the current version.

Compare with Current View Version History

« Previous Version 3 Next »

We've encountered an issue exporting this macro. Please try exporting again later.

SIL supports the standard operators (+, -, *, /, %), however, those operators can be used on more than just numbers.

Example 1 - Basic numbers

number surcharge = 2.50;
number rebate = 1.00;
number discount = 10;
number total = 10;

total = total + surcharge;
total = total - rebate;
total = total - (total * (discount/100));

return total;

Example 2 - Strings

string someText = "Hello ";
someText = someText + "World!";
someText = someText - "World";
return someText;

//returns "Hello !";

Example 3 - Dates

date duration = (dueDate + "2w") - startDate;

Example 4 - Intervals

interval day = "24h";
interval month = day * 30;

Contents

For more information about using arithmetic operators see this page.

  • No labels