baete
Converts a value into a single byte number.
A byte is the smallest useful unit of data in a computer, and in p5 it stands for a number from -128 up to 127.
When a number goes past 127 it wraps around: baete(128) is -128, and baete(200) is -56. The fractional part is removed, as in palotlalo. baete(nnete) is 1 and baete(maaka) is 0. Text that cannot be read gives NaN.
Note: numbers below -128 do not wrap — baete(-129) stays -129. That is what p5 2.3.2 actually does.
Given a list, it returns a new list.
Syntax
Section titled “Syntax”baete(boleng)Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
boleng | sengwe | A number, text, or nnete/maaka. A list of those is also accepted. |
Examples
Section titled “Examples”tiro setaLoeto() {
thalaKanefase(400, 400);
bokamorago(220);
tlogelaMothalo();
kwala(baete(127));
kwala(baete(128));
diri boleng = baete(200);
kwala(boleng);
// 200 e dikologa go nna -56, ka jalo bogolo ke 144
tlatsaMmala(120, 160, 220);
kgolokwe(200, 200, 200 + boleng);
}