is
A type check refines a stable binding inside the true branch.
Example.kalm
pub fun loud(value: Any) -> Text:
if value is Text:
return value.upper()
return "not text"
Example.kalm
pub fun loud(value: Any) -> Text {
if value is Text {
return value.upper()
}
return "not text"
}
Example.kalms
fun loud(value: Any) -> Text:
if value is Text:
return value.upper()
return "not text"
Example.kalms
fun loud(value: Any) -> Text {
if value is Text {
return value.upper()
}
return "not text"
}
Example.java
import java.util.Locale;
public final class Example {
public static String loud(Object value) {
if (value instanceof String text) return text.toUpperCase(
Locale.ROOT
);
return "not text";
}
}