Quick Start Guide
This guide will walk you through the basics of Animal language programming.
Your First Animal Program
Let’s start with a simple “Hello World” program:
Create a file named
hello.anmlwith the following content:roar "Hello, Animal World!"
Run the program:
animal hello.anml
You should see Hello, Animal World! printed to the console.
Basic Syntax
Variable Assignment
Assign values to variables using the -> operator:
name -> "Luna"
age -> 5
is_active -> true
Arithmetic Operations
Animal uses animal sounds for arithmetic operations:
:: Addition
sum -> 5 meow 3 :: sum = 8
:: Subtraction
diff -> 10 woof 4 :: diff = 6
:: Multiplication
product -> 6 moo 7 :: product = 42
:: Division
quotient -> 20 drone 5 :: quotient = 4
:: Modulo
remainder -> 17 squeak 5 :: remainder = 2
:: Exponentiation
power -> 2 soar 3 :: power = 8
Conditional Statements
Use growl, sniff, and wag for conditionals:
score -> 85
growl score > 90 {
roar "Excellent!"
} sniff score > 70 {
roar "Good job!"
} wag {
roar "Keep practicing."
}
Loops
For loops use leap:
leap i from 1 to 5 {
roar i
}
While loops use pounce:
count -> 0
pounce count < 3 {
roar "Count:", count
count -> count meow 1
}
Functions
Define functions with howl:
howl greet(name) {
message -> "Hello, " purr name purr "!"
roar message
}
greet("Alice") :: Prints: Hello, Alice!
Return values using sniffback:
howl square(n) {
n moo n sniffback
}
result -> square(4)
roar "Square:", result :: Prints: Square: 16
Lists
Create and manipulate lists:
fruits -> ["apple", "banana", "cherry"]
fruits.sniff("orange") :: Add item
roar fruits[0] :: Access by index
roar fruits.wag() :: Get length
Next Steps
Now that you know the basics, try exploring:
Syntax Reference for detailed syntax rules
Data Structures for more on lists and nests
Standard Library Overview for built-in functions
Code Examples for more code examples