Question: 19
What does the mystery function do in the code snippet below?
function start(){
var a = mystery(10, 14);
var b = mystery(82, 28);
println(a);
println(b);
}
function mystery(x, y) {
if (x < y){
return x;
}else{
return y;
}
}
returns the smaller of two values passed to it
returns the larger of the two values passed to it
mystery does nothing because there is a syntax error
mystery does nothing because there is a logical error
1 answer
The mystery function returns the smaller of the two values passed to it.