Operators

ASnake Documentation

Table Of Contents

Summary:

Operators in Python are symbols that perform actions on expressions. They can be:

  1. Unary which operates on one operand.
  2. Binary which operates on two operand.
  3. Ternary which operates on three operands. This page has a section which covers ternary.

It is a big topic that is covered better elsewhere. Skip to the ASnake specific section to see the operators it adds. Up until then, Python's operators will be listed with minimal explanation.

Unary Operators:

Operators that operate on one operand.

Binary Operators:

Operators that operate on two operands.

Logical

Operators that perform logical operations.

Linear Operators

Operators that perform arithmetic operations (usually on numerical values).

Bitwise

Operators that perform bitwise operations.

Examples:

Conditions

Operators used for comparison. Very useful for conditionals.

ASnake's Operators:

Unary Increment/Decrement

Increments and decrements are covered on this page.

Binary Divmod

/// is a shortcut for the builtin Python function divmod. It returns a tuple with the 0th element being the divide result, and the 1st element being the remainder result. You can use a index to access a specific value.

Example:

12 /// 2
# compiles to: divmod(12, 3)
# result: (6, 0)

12 /// 2 [0]
# result: 6

Tenary Operators:

There is only one, covered on the conditionals page.

Scroll to top