We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 710375f + e965e0b commit 37385bbCopy full SHA for 37385bb
examples/spells/basicSpells.qnt
@@ -50,6 +50,23 @@ module basicSpells {
50
assert(max(-5, -3) == -3),
51
}
52
53
+ /// Compute the minimum of two integers.
54
+ ///
55
+ /// - @param i first integer
56
+ /// - @param j second integer
57
+ /// - @returns the minimum of i and j
58
+ pure def min(i: int, j: int): int = {
59
+ if (i < j) i else j
60
+ }
61
+
62
+ run minTest = all {
63
+ assert(min(3, 4) == 3),
64
+ assert(min(6, 3) == 3),
65
+ assert(min(10, 10) == 10),
66
+ assert(min(-3, -5) == -5),
67
+ assert(min(-5, -3) == -5),
68
69
70
/// Compute the absolute value of an integer
71
///
72
/// - @param i : an integer whose absolute value we are interested in
0 commit comments