2
max
JailDoctor edited this page 2022-02-18 19:25:28 +01:00

max(x,y)

Ens torna el valor major entre x i y.

Paràmetres

x Un dels valors a comparar. y L'altre valor a comparar.

Exemple

function init()
    mode(2)
    x,y=10,7
    color(COLOR_YELLOW, COLOR_BLUE)
end

function update()
    cls()
    if btn(KEY_UP) then
        y = max(0, y-1)
    elseif btn(KEY_DOWN) then
        y = min(y+1, 14)
    end
    if btn(KEY_LEFT) then
        x = max(0, x-1)
    elseif btn(KEY_RIGHT) then
        x = min(x+1, 19)
    end
    print("\224",x,y)
end

Vore també