User Tools

Site Tools


4rpl:commands:specialsyntax

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
4rpl:commands:specialsyntax [2022/04/27 21:44] – [Vectors] color discussion Karsten754rpl:commands:specialsyntax [2025/02/14 14:57] (current) – external edit 127.0.0.1
Line 85: Line 85:
 ---- ----
 ===== Lists ===== ===== Lists =====
 +
 +<=[[4rpl:start#lists| List Commands]] \\
  
 Lists are collections of data. They are similar to arrays but they do not have a fixed length.  Lists are collections of data. They are similar to arrays but they do not have a fixed length. 
Line 100: Line 102:
 effectively setting element number "index" of the variable to whichever value is on top of the stack.  effectively setting element number "index" of the variable to whichever value is on top of the stack. 
 If **variable** is not a list, a warning will be printed to the console. If **variable** is not a list, a warning will be printed to the console.
 +
 +See also: [[4rpl:commands:specialsyntax#coerce table to list]]
  
 === Example === === Example ===
Line 115: Line 119:
 ---- ----
 ===== Tables ===== ===== Tables =====
 +
 +<=[[4rpl:start#Tables| Table Commands]] \\
  
 Tables are collection of named data. They are sometimes called dictionaries in other languages.  Tables are collection of named data. They are sometimes called dictionaries in other languages. 
Line 141: Line 147:
 </code> </code>
  
-It is possible to iterate over the elements in a table by coercing the table into a list. The following shows two equivalent methods to extract data from a table. The last of the two is slightly more efficient. +==== Coerce table to list  ==== 
 +It is possible to iterate over the elements in a table by coercing the table into a list. The following shows two equivalent methods to extract data from a table. Method Two is slightly more efficient. 
  
 === Example === === Example ===
Line 152: Line 159:
 Table ->units  Table ->units 
  
-# method 1+# method One
   
 Do (GetTablecount(<-units) 0) Do (GetTablecount(<-units) 0)
Line 160: Line 167:
 Loop Loop
  
-# method 2+# method Two
  
 GetTableKeys(<-units)->keys GetTableKeys(<-units)->keys
4rpl/commands/specialsyntax.1651095884.txt.gz · Last modified: 2025/02/14 14:56 (external edit)