Created
April 26, 2024 11:55
-
-
Save AxGord/df2613be714912d650c52c08101243c1 to your computer and use it in GitHub Desktop.
subtractionWithLimit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Test { | |
static function main() { | |
trace(subtractionWithLimit(0, 2, 1)); | |
} | |
static function subtractionWithLimit(a:UInt, b:UInt, min:UInt):Int { | |
return Std.int(Math.max(min + b, a)) - b; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment