Orion Language Reference
Basic Syntax
Variables
# Numbers
age = 25
pi = 3.14159
# Strings
name = "Orion"
message = 'Hello World'
# Booleans
is_active = True
is_complete = False
# Lists
numbers = [1, 2, 3, 4, 5]
mixed = [1, "hello", True]
# Dictionaries
person = {"name": "John", "age": 30}
Input/Output
# Display output
display "Hello, World!"
display variable_name
display 5 + 3
# Colored output
displayColoredText("Success!", "green")
displayColoredText("Error!", "red")
# Get user input
get name "What's your name? "
get age_str "Enter age: "
age = int(age_str)
Control Structures
# If statements
if age >= 18:
display "Adult"
elif age >= 13:
display "Teenager"
else:
display "Child"
# For loops
for i in range(5):
display i
for item in my_list:
display item
# While loops
count = 0
while count < 5:
display count
count = count + 1
Functions
# Simple function
def greet():
display "Hello!"
# Function with parameters
def greet_person(name):
display "Hello, " + name + "!"
# Function with return value
def add(a, b):
return a + b
# Call functions
greet()
greet_person("Alice")
result = add(5, 3)
Classes
class Person:
def __init__(self, name, age):
self.name = name
self.age = age
def greet(self):
display "Hi, I'm " + self.name
# Create and use objects
person = Person("Alice", 25)
person.greet()
display person.name
Operators
Arithmetic
a + b # Addition
a - b # Subtraction
a * b # Multiplication
a / b # Division
a % b # Modulo
a ** b # Exponentiation
Comparison
a == b # Equal
a != b # Not equal
a < b # Less than
a > b # Greater than
a <= b # Less than or equal
a >= b # Greater than or equal
Logical
a and b # Logical AND
a or b # Logical OR
not a # Logical NOT
Comments
# Single line comment
"""
Multi-line comment
Can span multiple lines
"""