**This is an old revision of the document!** ----
The functions we wrote in class are provided below. Each has a description of what we're illustrating, the filename, and then the file contents. You can cut & paste as needed. An example of an if-else statement. isOdd.m <code> function r = isOdd(n) % return 1 if n is odd, 0 if n is even if 2*floor(n/2) ~= n % this will test if n is not even r = 0; else r = 1; end </code> A simpler example of an if-else statement isTwo.m <code> function r = isTwo(n); % return 1 (true) if n is two, % 0 (false) if n is not two % simple example of an if statment if n == 2 r = 1; % true, n is two else r = 0; % false, n is not two end end </code>