This guide introduces the core concepts and syntax of TechScript 2.0.
TechScript is designed around one core rule: Write like a human, execute at native speeds. Semicolons and curly braces are replaced by clean English-like keywords, and scopes are closed with the end keyword.
Variables are dynamically typed and initialized on first assignment:
name = "Boss"
age = 30
is_active = true
Constants cannot be changed after declaration:
const PI = 3.14159
Use the when keyword for conditional branching:
score = 85
when score >= 90
say "A"
else when score >= 80
say "B"
else
say "F"
end
TechScript features three types of loop structures:
Executes a block exactly N times:
loop 5
say "Hello!"
end
Executes while a condition remains true:
count = 0
repeat count < 5
count += 1
say count
end
Iterates over lists, maps, or ranges:
# Range iteration (inclusive)
for i in 1..=5
say i
end
# List iteration
names = ["Alice", "Bob"]
for name in names
say name
end
Functions are declared using the do keyword and return values using the send keyword:
do calculate_square(x)
send x * x
end
result = calculate_square(4)
say result # 16
Classes are declared using the class keyword. Use the constructor method named init to initialize values:
class Dog
name = ""
do init(name)
self.name = name
end
do speak()
say $"{self.name} says Woof!"
end
end
my_dog = new Dog("Fido")
my_dog.speak()