Array length: Difference between revisions

Content deleted Content added
Added Dyalect programming language
Added Robotic implementation
Line 1,760:
 
<lang ring>See len(['apple', 'orange']) # output = 2 </lang>
 
=={{header|Robotic}}==
As stated before in the [[Arrays#Robotic|arrays]] section on this Wiki, there is no functions listed for the manipulation/status of arrays. The best way we can count for length in an array is to have a variable keep track of it.
 
Example 1:
<lang robotic>
set "index" to 0
set "$array&index&" to "apple"
inc "index" by 1
set "$array&index&" to "orange"
* "Array length: ('index' + 1)"
</lang>
 
Example 2:
<lang robotic>
set "index" to 0
set "local1" to random 1 to 99
: "rand"
set "array&index&" to random 0 to 99
inc "index" 1
dec "local1" 1
if "local1" > 1 then "rand"
* "Array length: ('index')"
</lang>
 
=={{header|Ruby}}==