Mercurial Hosting > luan
comparison website/src/manual.html.luan @ 1926:4206242c7a13
better css
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Wed, 23 Apr 2025 15:34:48 -0600 |
parents | d2a1dbfd402f |
children |
comparison
equal
deleted
inserted
replaced
1925:0156fe64a610 | 1926:4206242c7a13 |
---|---|
1284 Any expression enclosed in parentheses always results in only one value. | 1284 Any expression enclosed in parentheses always results in only one value. |
1285 Thus, | 1285 Thus, |
1286 <code>(f(x,y,z))</code> is always a single value, | 1286 <code>(f(x,y,z))</code> is always a single value, |
1287 even if <code>f</code> returns several values. | 1287 even if <code>f</code> returns several values. |
1288 (The value of <code>(f(x,y,z))</code> is the first value returned by <code>f</code> | 1288 (The value of <code>(f(x,y,z))</code> is the first value returned by <code>f</code> |
1289 or <b>nil</b> if <code>f</code> does not return any values.) | 1289 or <code>nil</code> if <code>f</code> does not return any values.) |
1290 </p> | 1290 </p> |
1291 <% | 1291 <% |
1292 end | 1292 end |
1293 subs = { | 1293 subs = { |
1294 arithmetic = { | 1294 arithmetic = { |
1298 <p> | 1298 <p> |
1299 Luan supports the following arithmetic operators: | 1299 Luan supports the following arithmetic operators: |
1300 </p> | 1300 </p> |
1301 | 1301 |
1302 <ul> | 1302 <ul> |
1303 <li><b><code>+</code>: </b>addition</li> | 1303 <li><b>+</b>: addition</li> |
1304 <li><b><code>-</code>: </b>subtraction</li> | 1304 <li><b>-</b>: subtraction</li> |
1305 <li><b><code>*</code>: </b>multiplication</li> | 1305 <li><b>*</b>: multiplication</li> |
1306 <li><b><code>/</code>: </b>float division</li> | 1306 <li><b>/</b>: float division</li> |
1307 <li><b><code>//</code>: </b>floor division</li> | 1307 <li><b>//</b>: floor division</li> |
1308 <li><b><code>%</code>: </b>modulo</li> | 1308 <li><b>%</b>: modulo</li> |
1309 <li><b><code>^</code>: </b>exponentiation</li> | 1309 <li><b>^</b>: exponentiation</li> |
1310 <li><b><code>-</code>: </b>unary minus</li> | 1310 <li><b>-</b>: unary minus</li> |
1311 </ul> | 1311 </ul> |
1312 | 1312 |
1313 <p> | 1313 <p> |
1314 Addition, subtraction, multiplication, division, and unary minus are the same as these operators in Java. Exponentiation uses Java's <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#pow-double-double-">Math.pow</a> function. | 1314 Addition, subtraction, multiplication, division, and unary minus are the same as these operators in Java. Exponentiation uses Java's <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#pow-double-double-">Math.pow</a> function. |
1315 </p> | 1315 </p> |
1348 <p> | 1348 <p> |
1349 Luan supports the following relational operators: | 1349 Luan supports the following relational operators: |
1350 </p> | 1350 </p> |
1351 | 1351 |
1352 <ul> | 1352 <ul> |
1353 <li><b><code>==</code>: </b>equality</li> | 1353 <li><b>==</b>: equality</li> |
1354 <li><b><code>~=</code>: </b>inequality</li> | 1354 <li><b>~=</b>: inequality</li> |
1355 <li><b><code><</code>: </b>less than</li> | 1355 <li><b><</b>: less than</li> |
1356 <li><b><code>></code>: </b>greater than</li> | 1356 <li><b>></b>: greater than</li> |
1357 <li><b><code><=</code>: </b>less or equal</li> | 1357 <li><b><=</b>: less or equal</li> |
1358 <li><b><code>>=</code>: </b>greater or equal</li> | 1358 <li><b>>=</b>: greater or equal</li> |
1359 </ul> | 1359 </ul> |
1360 | 1360 |
1361 <p> | 1361 <p> |
1362 These operators always result in <b>false</b> or <b>true</b>. | 1362 These operators always result in <code>false</code> or <code>true</code>. |
1363 </p> | 1363 </p> |
1364 | 1364 |
1365 <p> | 1365 <p> |
1366 Equality (<code>==</code>) first compares the type of its operands. | 1366 Equality (<code>==</code>) first compares the type of its operands. |
1367 If the types are different, then the result is <b>false</b>. | 1367 If the types are different, then the result is <code>false</code>. |
1368 Otherwise, the values of the operands are compared. | 1368 Otherwise, the values of the operands are compared. |
1369 Strings, numbers, and binary values are compared in the obvious way (by value). | 1369 Strings, numbers, and binary values are compared in the obvious way (by value). |
1370 </p> | 1370 </p> |
1371 | 1371 |
1372 <p> | 1372 <p> |
1388 </p> | 1388 </p> |
1389 | 1389 |
1390 <p> | 1390 <p> |
1391 Equality comparisons do not convert strings to numbers | 1391 Equality comparisons do not convert strings to numbers |
1392 or vice versa. | 1392 or vice versa. |
1393 Thus, <code>"0"==0</code> evaluates to <b>false</b>, | 1393 Thus, <code>"0"==0</code> evaluates to <code>false</code>, |
1394 and <code>t[0]</code> and <code>t["0"]</code> denote different | 1394 and <code>t[0]</code> and <code>t["0"]</code> denote different |
1395 entries in a table. | 1395 entries in a table. |
1396 </p> | 1396 </p> |
1397 | 1397 |
1398 <p> | 1398 <p> |