Hello I have this sample script for the definition and call of functions.
It works perfectly regardless of the order of the numbers passed to the function, it always returns the largest.
I have this other variation.
Here the problem is that if I change the order of the numbers, the function does not return the highest, it seems that it always returns the first.
What could this be due to? Is the way to call the function and pass it the arguments wrong?
a greeting
Code:
123456789101112
function max(numero1, numero2)
if (numero1 > numero2) then
resultado = numero1;
else
resultado = numero2;
end
return resultado; --
end
log('El valor máximo de la comparación de dos valores es',max(4,10))
log('El valor máximo de la comparación de dos valores es',max(6,5))I have this other variation.
Code:
123456789101112
max = 4, 10
log('El valor máximo de la comparación de dos valores es', max)
function max(numero1, numero2)
if (numero1 > numero2) then
resultado = numero1;
else
resultado = numero2;
end
return(resultado)
endHere the problem is that if I change the order of the numbers, the function does not return the highest, it seems that it always returns the first.
What could this be due to? Is the way to call the function and pass it the arguments wrong?
a greeting