 |
 |
 |
 |
| Name |
|
constrain() |
 |
|
|
| Examples |
|
int t = constrain(t, 30, 70); // makes sure t is between the values 30 and 70
|
|
|
| Description |
|
Constrains a value to not exceed a maximum and minimum value. |
 |
|
|
| Syntax |
|
constrain(value, min, max)
|
 |
|
|
| Parameters |
|
| value |
|
int or float: the value to constrain
|
| min |
|
int or float: minimum limit
|
| max |
|
int or float: maximum limit
|
|
 |
|
|
| Returns |
|
float or int (depending on the input values) |
 |
|
|
| Usage |
|
Web & Application |
 |
|
|
| Related |
|
max() min() |
|