This guide introduces the core concepts and canonical syntax of TechScript 2.0.
TechScript is designed around one core rule: Write like a human, execute at native speeds. Blocks are defined using a colon : followed by 4-space indentation.
Variables are dynamically typed and initialized on first assignment using is:
name is "Alice"
age is 30
is_active is true
Variables are updated using becomes:
age becomes age + 1
Constants cannot be changed after declaration:
constant PI is 3.14159
Use standard if, else if, and else blocks:
score is 85
if score >= 90:
say "A"
else if score >= 80:
say "B"
else:
say "F"
TechScript features clean loop structures:
Executes a block exactly N times:
repeat 5 times:
say "Hello!"
Executes while a condition remains true:
count is 0
while count < 5:
count becomes count + 1
say "Count: {count}"
Iterates over lists, maps, or collections:
names is ["Alice", "Bob"]
for name in names:
say "Name: {name}"
Functions are declared using to name(params): and return values using return:
to calculate_square(x):
return x * x
result is calculate_square(4)
say "Result: {result}" # 16
Classes are declared using the class keyword with colon and indentation:
class Dog:
name is ""
to init(name):
self.name becomes name
to speak():
say "{self.name} says Woof!"
my_dog is new Dog("Fido")
my_dog.speak()