Failure contexts and the Floor() function

You have to call failable functions like Floor with [] instead of ()
Then you can choose how you want to handle the failure

Option 1: Return a default value if Floor fails

if(Digit1 := Floor[TrackerFloatValue/1000.0]):
    return Digit1
else:
    return 0

Option 2: Return a ?int instead of int

if(Digit1 := Floor[TrackerFloatValue/1000.0]):
    return option{digit1}
else:
    return false?
2 Likes