ascii
09/13/2023, 11:49 AMval zero = if (condition) 0f else 0f
val division = 1f / zero // no division by zero warning
ascii
09/13/2023, 11:51 AMephemient
09/13/2023, 11:54 AMascii
09/13/2023, 12:03 PMephemient
09/13/2023, 12:06 PMval zero = if (condition) 0 else 0
val division = 1 / zero
eitherRobert Williams
09/14/2023, 9:37 AMif (x) y else y
Robert Williams
09/14/2023, 9:37 AMRobert Williams
09/14/2023, 10:36 AMRobert Williams
09/14/2023, 10:37 AMRobert Williams
09/14/2023, 10:47 AMWe use the term “constant expression” to refer to any expression constructed of the following:
constant literals
access expressions to enum entries
string interpolation over constant expressions
an implementation-defined set of functions that can always be evaluated at compile-time
Robert Williams
09/14/2023, 10:48 AMRobert Williams
09/14/2023, 10:49 AM``` int x = true ? 0 : 0;
int y = 1 / x;```