Small ML Language
  • Small ML language
  • Installation
  • Hello World
  • Basics
    • Literals
    • Types
    • Type casting
    • Variables
    • Operators
    • Functions
    • Function chaining
    • Conditionals
    • Match
    • Arrays
    • Structs
    • Structure field Access
    • Enums
    • Enum Specialization
    • Object Destructuring
    • Modules
  • Compiler internals
    • SMLL to JAVA
Powered by GitBook
On this page
  • Binary operators
  • Unary Operator
  1. Basics

Operators

Operation success!!

Operators play a crucial role in computing values in programs and calculations in general. SMLL supports three kinds of operators separated in to two categories, see below:

Binary operators

Math operators

Operator
Description

+

Adding two numeric values

-

Subtracting two numeric values

*

Multiplying two numeric values

/

Dividing two numeric values

%

Computing the modulus of two numeric values

Logic Operators

Logic operators are also know as boolean operators, because they generate values of type Bool

Operator
Description

>

Greater than

<

Less than

>=

Greater or Equals to

<=

Less of Equals to

==

Equal

!=

Not equal

?

Value if of type

A Tiny Quirk

SMLL has a binary operator for checking if a value is of a certain type. The operator takes the following form.

10?Int

Bitwise Operat

ors

SMLL supports basic bitwise operators similar to languages like c and rust.

>>

Bitwise shift-right

<<

Bitwise shift-left

&

Bitwise and

|

Bitwise or

Some bitwise operators are explained below, in the unary section

Unary Operator

Unary operators operate on a single value or operand. SMLL supports unary operators from all categories.

Math operators

Operator
Description

| <value> |

Abs operator

Logical operators

Operator
Description

!

Logical not

?

Is null

Bitwise operators

Operator
Description

~

Bitwise not

PreviousVariablesNextFunctions

Last updated 10 months ago