Scala preconditions
def doublePositive(n: Int): Int = { | |
require(n > 0) | |
n * 2 // logic | |
} ensuring(n => n >= 0 && n % 2 == 0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment