Getting Started
ADBIR is a modern programming language designed for simplicity and performance. This guide will help you get started with ADBIR.
Installation
# Install ADBIR
adbir install
# Verify installation
adbir --version
Your First Program
// hello.adbir
fn main() {
print("Hello, ADBIR!");
}
Syntax
ADBIR's syntax is clean and intuitive. Here are the basic syntax rules:
Comments
// Single line comment
/*
Multi-line
comment
*/
Basic Structure
// Every ADBIR program starts with a main function
fn main() {
// Your code here
}
Variables
Variables in ADBIR are declared using the `let` keyword:
let x = 10; // Integer
let y = 3.14; // Float
let name = "ADBIR"; // String
let is_valid = true; // Boolean
Functions
Functions are declared using the `fn` keyword:
// Function with parameters and return type
fn add(a: int, b: int) -> int {
return a + b;
}
// Function without parameters
fn greet() {
print("Hello!");
}
Control Flow
ADBIR supports standard control flow statements:
// If statement
if x > 10 {
print("x is greater than 10");
} else {
print("x is less than or equal to 10");
}
// For loop
for i in 0..10 {
print(i);
}
// While loop
while x > 0 {
x = x - 1;
}
Types
ADBIR has several built-in types:
int // Integer numbers
float // Floating point numbers
string // Text
bool // Boolean (true/false)
array // Collection of values
map // Key-value pairs
Standard Library
The ADBIR standard library provides useful functions:
// String operations
let s = "Hello";
print(s.length()); // 5
print(s.upper()); // "HELLO"
// Array operations
let arr = [1, 2, 3];
print(arr.length()); // 3
print(arr.push(4)); // [1, 2, 3, 4]