Add 'min'
44
min.md
Normal file
44
min.md
Normal file
@@ -0,0 +1,44 @@
|
||||
# min(x,y)
|
||||
Ens torna el valor menor entre x i y.
|
||||
|
||||
### Paràmetres
|
||||
|
||||
`x`
|
||||
Un dels valors a comparar.
|
||||
`y`
|
||||
L'altre valor a comparar.
|
||||
|
||||
### Exemple
|
||||
```
|
||||
function init()
|
||||
setmode(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é
|
||||
* [abs(x)](abs)
|
||||
* [ceil(x)](ceil)
|
||||
* [flr(x)](flr)
|
||||
* [sgn(x)](sgn)
|
||||
* [sin(x)](sin)
|
||||
* [cos(x)](cos)
|
||||
* [atan2(x,y)](atan2)
|
||||
* [sqrt(x)](sqrt)
|
||||
* [max(x,y)](max)
|
||||
* [mid(x,y,z)](mid)
|
||||
Reference in New Issue
Block a user