zedocs
GitHub ↗
Language

Operators

Arithmetic, natural-language comparisons, and logical operators in Ze.

Ze supports the standard set of arithmetic, comparison, and logical operators. Every operator has both a symbol form and one or more word forms in all three languages.


Arithmetic

OperationSymbolEnglish wordTagalog wordBisaya word
Add+plusdagdagdagdag
Subtract-minusbawasbawas
Multiply*times / multiplybesespilo
Divide/dividehatiinbahinon
Modulo%remainder / modulonatiranahibilin
Power^power / squaredpuwersagahum
show 10 + 3         # 13
show 10 minus 3     # 7
show 4 times 5      # 20
show 10 divide 4    # 2.5
show 10 remainder 3 # 1
show 2 ^ 8          # 256

Comparison

All comparison operators return true or false.

MeaningSymbolEnglish phraseTagalog phraseBisaya phrase
Equal==is / is equal toay / ay katumbas ngmao / katumbas sa
Not equal!=is not / is not equal toay hindidili sama sa / dili katumbas sa
Greater than>is greater thanay mas malaki samas dako sa
Less than<is less thanay mas maliit samas gamay sa
Greater than or equal>=is at least / is greater than or equalay hindi bababa sadili moubos sa
Less than or equal<=is at most / is less than or equalay hindi lalampas sadili molapas sa
show 5 is 5                         # true
show 5 is not 3                     # true
show 10 is greater than 7           # true
show 3 is less than 8               # true
show 5 is at least 5                # true  (>=)
show 4 is at most 10                # true  (<=)

# Tagalog
show 10 ay mas malaki sa 7          # true
show 5 ay hindi bababa sa 5         # true

# Bisaya
show 10 mas dako sa 7               # true
show 5 dili moubos sa 5             # true

Logical

OperatorEnglishTagalogBisaya
ANDand / and alsoat / at sakaug / ug usab
ORor / or elseo / o kayao / o kaha
NOTnothindidili
show true and false         # false
show true or false          # true
show not true               # false

# Tagalog
show totoo at mali          # false
show totoo o mali           # true
show hindi totoo            # false

# Bisaya
show tinuod ug bakak        # false
show tinuod o bakak         # true
show dili tinuod            # false

Precedence (highest to lowest)

LevelOperators
8 — Power^ / power / puwersa / gahum
7 — Multiply/Divide* / % and word forms
6 — Add/Subtract+ - and word forms
5 — Comparison== != < > <= >= and phrase forms
3 — NOTnot / hindi / dili
2 — ANDand / at / ug
1 — ORor / o

Use parentheses ( ) to override precedence:

show 2 + 3 * 4          # 14  (multiply first)
show (2 + 3) * 4        # 20  (parens first)

String Concatenation

The + operator concatenates strings. If either operand is not a string, it is automatically converted.

show "Hello, " + "World!"          # Hello, World!
show "Score: " + word(score)       # Score: 95
show "Items: " + count fruits      # Items: 3
Help make these docs better.Edit this page on GitHub ↗

Find a guide or search the language reference.