20 lines
443 B
MonkeyC
20 lines
443 B
MonkeyC
import Toybox.Lang;
|
|
|
|
typedef Numeric as Number or Float or Long or Double;
|
|
|
|
// no types here, because this is generic, which are not supported by language
|
|
function getOrElse(value, defaultValue) {
|
|
if (value == null) {
|
|
return defaultValue;
|
|
} else {
|
|
return value;
|
|
}
|
|
}
|
|
|
|
function min(left as Numeric, right as Numeric) as Numeric {
|
|
if (left < right) {
|
|
return left;
|
|
} else {
|
|
return right;
|
|
}
|
|
} |