Language symbols

For each symbol, a code snippet shows an example of its use.

Quick links:

& (ampersand)

The ampersand is a binary infix operator. It returns a String that is the concatenation of its left and right operands:

salutation := "Dear " & name & ","

() (parentheses)

Parentheses enclose the arguments of a call, and are used within expressions to override the default order of precedence:

print_line(distance(3, (4 + 5) * 2)

* (asterisk)

The asterisk is a binary infix operator. It returns the product of its left and right operands:

price := quantity * unit_cost

+ (plus)

The plus sign is a binary infix operator. It returns the sum of its left and right operands:

total := price + tax

The plus sign is also a unary prefix operator which returns its right operand:

print_line(+total)

, (comma)

The comma separates the arguments of a call:

show_window(height, width, bits_per_pixel)

The comma may also optionally be used to separate parentclasses, local declarations and attribute declarations:

inherit FIRST_PARENT, SECOND_PARENT ... local a, b, c

The comma is also used to separate items within a manifest array or a manifest table:

[red, blue, green, yellow] {"red" => 1.50, "blue" => 2.75}

- (minus)

The minus sign (hyphen character) is a binary infix operator. It returns the value of its right operand subtracted from its left operand:

total := price - discount

The minus sign is also a unary prefix operator which returns the negation of its right operand:

print_line(-total)

. (dot)

The dot is used within a call chain to separate the invocant (on its left) from the feature name and arguments (on its right):

print_line(customer.mailing_address.line(4))

/ (slash)

The slash is a binary infix operator. It returns the value of its left operand divided by its right operand:

mean_weight := total_weight / number_of_items

/= (not_equal)

The "not equal" symbol is a binary infix operator. It returns the BOOLEAN value false if its left and right operands are equal, otherwise it returns true:

if input /= pass_number then display_error_message end

// (integer_division)

The double-slash symbol is a binary infix operator. It returns the value of its left operand divided by its right operand, then truncated downwards to the integer equal to or just below the exact result of the division:

players_per_team := players // teams

: (colon)

The colon is not currently used as a symbol in Amber source code, but it is likely to be used in the future for some kind of optional type declaration:

local i: INTEGER -- (speculative example)

:= (assignment)

The assignment operator separates the target (on the left) from the expression that will be assigned to the target (on the right):

a := b + c

; (semicolon)

The semicolon is used to separate multiple instructions when they are written on the same line:

update_settings ; check_settings ; report_settings

< (less_than)

The "less than" symbol is a binary comparison operator. It returns true if the operand on its left is less than the operand on its right, otherwise it returns false:

if size < 20 then postage := 50 end

<= (less_than_or_equals)

The "less than or equals" symbol is a binary comparison operator. It returns true if the operand on its left is less than or equal to the operand on its right, otherwise it returns false:

if size <= 20 then postage := 50 end

= (equals)

The equal sign is a binary infix operator. It returns the BOOLEAN value true if its left and right operands are equal, otherwise it returns false:

if input = pass_number then allow_login end

=> (table_arrow)

The "table arrow" separates the key of an item in a manifest table (on the left) from the value associated with that key (on the right):

{"red" => 1.50, "blue" => 2.75}

> (greater_than)

The "greater than" symbol is a binary comparison operator. It returns true if the operand on its left is greater than the operand on its right, otherwise it returns false:

if size > 20 then postage := 75 end

>= (greater_than_or_equals)

The "greater than or equals" symbol is a binary comparison operator. It returns true if the operand on its left is greater than or equal to the operand on its right, otherwise it returns false:

if size >= 20 then postage := 75 end

[] (brackets)

Brackets are used to enclose a manifest array:

[red, blue, green, yellow]

{} (braces)

Braces are used to enclose a manifest table:

{"red" => 1.50, "blue" => 2.75}

sh: /home/web/cgi/eiffelzone/comments.exe: No such file or directory