beginner first-steps

Variables and Types

When your program needs to remember something — a name, a score, a temperature — you store it in a variable. In Clean Language, every variable has a type, and you write the type first. This might feel different at first, but it makes your code much easier to read at a glance.

Part of: Install and setup

start:
	string name = "Alice"
	integer age = 28
	number height = 1.72
	boolean active = true

	print(name)
	print(age.toString())
	print(height.toString())
	print(active.toString())
Alice
28
1.72
true

Clean Language has four basic types: string for text, integer for whole numbers, number for decimals, and boolean for true/false.

You can change a variable's value after you declare it:

start:
	integer score = 0
	print(score.toString())

	score = 100
	print(score.toString())
0
100

Notice .toString() — whenever you want to print a number or boolean, you convert it to a string first. Clean keeps types strict so mistakes get caught early.

  • Write the type first, then the name, then the value: integer age = 28
  • Four basics: string, integer, number, boolean
  • Use .toString() to convert numbers and booleans for printing
  • You can reassign a variable anytime — just write variableName = newValue
📚 → Book 1, Chapter 5 : Working with Text →
Copied!