untitled.ss
StructScript v1.2 — Ready
Press ▶ Run or Ctrl+Enter to execute
No errors
Examples →
Ready
1 line
Ln 1, Col 1
StructScript v1.2

StructScript v1.1
Language Reference

A clean, readable language blending natural English with Python-style indentation. Built for beginners, scripters, and systems thinkers.

🧱 Structured

Indentation-based blocks. No braces needed. Clean and readable at a glance.

📖 Readable

Keywords read like English: say, define, count from to, repeat times.

⚡ Capable

Functions, structs, lists, error handling, string ops, math — all built in.

🛡️ Safe

Clear error messages with line numbers and code snippets. Stack overflow protection.

Variables & Constants

SyntaxExampleNotes
let name = valuelet x = 42Mutable variable
const name = valueconst PI = 3.14159Immutable constant
set name = valueset x = x + 1Reassign existing variable
set obj.field = valset person.age = 30Struct field assignment

Types

TypeExamplesNotes
Number42, 3.14, -7Integer or float
String"hello", 'world'Single or double quotes
Booleantrue, falseLogical values
NothingnothingNull/None equivalent
List[1, 2, 3]Ordered, mutable collection
StructPoint()Custom data type

Operators

CategoryOperators
Arithmetic+ - * / % ** //
Comparison== != > < >= <=
Logicaland or not
String+ (concat), * (repeat)

Control Flow

if x > 0: say "positive" else if x < 0: say "negative" else: say "zero" while x < 100: set x = x * 2 repeat 5 times: say "hello" count i from 1 to 10: say i for each item in myList: say item

Functions

define greet(name): say "Hello, " + name define add(a, b): return a + b // Default parameters define power(base, exp = 2): return base ** exp greet("World") let result = add(3, 4)

Error Handling

try: let x = 10 / 0 catch err: say "Caught: " + err try: riskyFunction() catch e: say "Error: " + e finally: say "Always runs"

Built-in Functions

FunctionDescriptionExample
say(x)Print to outputsay "hi"
length(x)Length of list/stringlength([1,2,3]) → 3
push(list, val)Append to listpush(nums, 4)
pop(list)Remove last itempop(nums)
join(list, sep)Join list to stringjoin(items, ", ")
split(str, sep)Split string to listsplit("a,b", ",")
upper(str)Uppercase stringupper("hi") → "HI"
lower(str)Lowercase stringlower("HI") → "hi"
trim(str)Strip whitespacetrim(" hi ")
contains(str, sub)Check substringcontains("hello", "ell")
replace(str,old,new)Replace in stringreplace("hi","h","b")
slice(list, a, b)Sub-list or substringslice(nums, 0, 3)
sort(list)Sort a listsort([3,1,2])
reverse(list)Reverse a listreverse([1,2,3])
range(n) / range(a,b)Generate number listrange(5) → [0..4]
abs(n)Absolute valueabs(-5) → 5
sqrt(n)Square rootsqrt(16) → 4
floor/ceil/roundRoundingfloor(3.7) → 3
max/minMax/min of argsmax(1,5,3) → 5
random()Random 0–1 floatrandom()
randint(a,b)Random integerrandint(1,6)
str(x)Convert to stringstr(42) → "42"
num(x)Convert to numbernum("42") → 42
bool(x)Convert to booleanbool(0) → false
type(x)Get type nametype(42) → "number"
isNothing(x)Check for nothingisNothing(val)