Unit
The unit type in Gera is a type which only has a single value, this being unit. This also means that there is no information associated with this type, since it can only ever be one value. One could also consider unit to represent there not being a value it all.
Return Values
The unit type can be useful for when you want to return nothing from a procedure. In fact, when you don't return anything from a procedure at all, the procedure is assumed to return unit.
mod example
proc main() {
return unit
std::io::println("noone will ever see this")
}
proc main() {
return unit
std::io::println("noone will ever see this")
}
Equality
Note that since the unit type only has one value, using == on unit always results in true and != always results in false.