??=

Assign a fallback to a nullable mutable binding only when needed.

Example.kalm
pub fun main() -> Unit:
    var title: Text? = null
    title ??= "Untitled"
    sayLine(title)
Example.kalm
pub fun main() -> Unit {
    var title: Text? = null
    title ??= "Untitled"
    sayLine(title)
}
Example.kalms
var title: Text? = null
title ??= "Untitled"
sayLine(title)
Example.kalms
var title: Text? = null
title ??= "Untitled"
sayLine(title)
Example.java
void main() {
    String title = null;
    if (title == null) title = "Untitled";
    System.out.println(title);
}

Learn more.