Skip to content

Instantly share code, notes, and snippets.

@jbranchaud
Created March 11, 2013 02:20
Show Gist options
  • Save jbranchaud/5131506 to your computer and use it in GitHub Desktop.
Save jbranchaud/5131506 to your computer and use it in GitHub Desktop.
Exercise 4 from Microsoft's Dafny on Rise4Fun.com
/*
* Write a function max that returns the larger of two given
* integer parameters. Write a test method using an assert that
* checks that your function is correct.
*/
function max(a: int, b: int): int
{
if a > b then a else b
}
method Testing() {
assert max(10,12) == 12;
assert max(12,10) == 12;
assert max(10,10) == 10;
assert max(-10,0) == 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment