Lantica Software Support Center
Lantica Software Home Page
Order Sesame Getting Started Support Center Contact Us Company Downloads Q&A ™  
Search

Knowledgebase Home

Programming Operators and Precedence of Calculation

An operator is a mathematical symbol or term used to connect or compare two or more parts of a program or assign a value. The following shows Sesame-supported operators with usage examples:

+ Addition1
Total = Amount + Sales Tax
FullName = FirstName + " " + LastName
@Msg("Ordering " + @Str(Qty) + " " + Item + "(s)")
- Subtraction
Difference = GrandTotal = EstimatedTotal
* Multiplication
Sales Tax = Amount = .072
/ Division
Cost = Amount / Quantity
= Equal to
If Priority = "A" Then ShipDate = OrderDate + 1
< Less than
If ShipDate < OrderDate Then WriteLn("Whoops!")
> Greater than
If (@Year(@Date)) - @Year(BirthDate)) > 16 Then Class = "Adult"
<= Less than or equal to
If BirthDate <= @D(1999/12/31) Then WriteLn("Child of the 20th Century (probably)")
>= Greater than or equal to
If Qty >= 1000 then Price = Price * .95
<> Not equal to
If State <> "PA" Then @Msg("No Sales Tax")
AND Both comparisons are true
If ((@Yr(@Date) - @Yr(BirthDate)) < 17) AND (Gender = "M") Then @Msg("Now behave yourself, laddie")
OR Either comparison is true
If (Total . 1000) OR (Status = "VIP") Then @Msg("Order must be shipped by " + @Str(OrderDate + 1))
NOT Reverses comparison
If NOT @Error Then @Msg(It Worked!")

1Arithmetically sums values if they are of numeric data type, as assumed in first example (includes Integer, Double, Money, Boolean, Date, Time values). Otherwise, concatenates (combines) values as in second example. Typecasting functions can be used to convert between data types.

Precedence of Calculation in Programming
The following show precedence (the order) of calculation from highest (calculated first) to lowest (calculated last) (operators on the same line have the same precedence – Sesame evaluates them from left to right as they appear in your program). As a matter of good practice, you should use parentheses to control precedence rather than depend on the following order.
  • (...) Anything contained in parentheses
  • * / Multiplication and division
  • + - Addition and subtraction
  • <, >, <=, >=, <> Lesser than, greater than, less than or equal to, greater than or equal to, not equal to
  • NOT Reverses comparison’s values
  • AND OR Both comparisons true, either comparison true

Properties ID: 000237   Views: 1363   Updated: 13 years ago
Filed under:
Programming
Working With Your Data / Records

Copyright Lantica Software, 2003-2025 All rights reserved