Skip to content

Instantly share code, notes, and snippets.

@jbranchaud
Created March 11, 2013 01:09
Show Gist options
  • Save jbranchaud/5131286 to your computer and use it in GitHub Desktop.
Save jbranchaud/5131286 to your computer and use it in GitHub Desktop.
Exercise 0 from Microsoft's Dafny tutorial on Rise4Fun.com
/*
* Write a method Max that takes two integer parameters and returns
* their maximum. Add appropriate annotations and make sure your code
* verifies.
*/
method Max(a: int, b:int) returns (c: int)
ensures c >= a && c >= b;
{
if (a > b) {
return a;
}
else {
return b;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment