palophatlo
Converts text that resembles a number into a number with a fractional part.
When the text is "12.34", palophatlo hands it back as the number 12.34, which you can then do arithmetic with. If it cannot be read — say palophatlo("kgomo") — you get NaN.
The difference between palophatlo and palotlalo is the fractional part: palotlalo("12.34") is 12, while palophatlo("12.34") is 12.34. When you want a scale between 0 and 1, palophatlo is the one you need.
Given a list of strings, it returns a list of numbers.
Syntax
Section titled “Syntax”palophatlo(boleng)Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
boleng | mokwalo | Text that resembles a number. A list of strings is also accepted. |
Examples
Section titled “Examples”tiro setaLoeto() {
thalaKanefase(400, 400);
bokamorago(220);
tlogelaMothalo();
diri boleng = "0.75";
diri tekanyo = palophatlo(boleng);
kwala(tekanyo);
tlatsaMmala(220, 90, 40);
kgolokwe(200, 200, 300 * tekanyo);
}tiro setaLoeto() {
thalaKanefase(400, 400);
bokamorago(220);
tlogelaMothalo();
diri boleng = ["0.4", "0.7", "1.0"];
diri ditekanyo = palophatlo(boleng);
kwala(ditekanyo);
diri x = 100;
gopheta (metlha tekanyo mo ditekanyo) {
tlatsaMmala(0, 140, 200);
kgolokwe(x, 200, 130 * tekanyo);
x = x + 100;
}
}