Wednesday, February 15, 2012

SOFT6008 Functions

In the next class we will look at functions. I put an example with the following function in your dropbox.

function maximus (a,b,c)
{
if ( (a>=b) && (a>=c))
 {
 result = a;
 }
else if (b>=c)
 {
 result = b;
 }
else
 {
 result = c;
 }
return result

}

The function runs once with literal values, and once with user input values. But it doesn't behave like you'd expect. See if you can figure out what's going on.

No comments: