Explore Clean Language syntax — a comprehensive reference of all language features, operators, and constructs.
integer count = 42
string name = "Clean"
Declare variables with explicit type annotations. Clean Language uses indentation-based syntax and requires type declarations for safety.
functions:
integer add(integer a, integer b)
return a + b
Define functions with typed parameters and return types. Functions must be declared in a functions: block and use indentation-based syntax.
class Animal
properties:
string name
integer age
methods:
string describe()
return name + " is " + _itos(age)
Define classes with properties and methods blocks. Clean Language supports object-oriented programming with clean, indentation-based syntax.
if score > 90
grade = "A"
else if score > 80
grade = "B"
else
grade = "C"
Conditional execution using indentation-based syntax. No parentheses or braces needed - Clean Language uses clean, readable control flow.
for integer i = 0, i < 10, i + 1
_print(_itos(i))
Iterate with initialization, condition, and increment expressions separated by commas. Clean's for loops use indentation-based blocks.
async functions:
string fetchData()
string result = await _http_get(url)
return result
Define asynchronous functions in an async functions: block. Use await to wait for async operations to complete before continuing execution.
plugins:
frame.httpserver
frame.data
Import plugins and modules using the plugins: block. Clean Language uses a simple module system for organizing and reusing code.
onError
_print("Something went wrong")
_print(_error_message())
Handle errors using the onError block. Clean Language provides built-in error handling functions like _error_message() to access error details.