Pick random element: Difference between revisions
Content deleted Content added
Add NetRexx implementation |
m →{{header|REXX}}: added note about version 2 not working for some REXXes. -- ~~~~ |
||
Line 428:
=={{header|REXX}}==
===version 1===
This REXX example takes the task very literally.
<lang rexx>/*REXX program to pick a random element from a list (tongue in cheek). */
Line 448 ⟶ 449:
w=words(_)
say 'random element ='
/*stick a fork in it, we're done.*/</lang>
'''output'''
Line 454 ⟶ 455:
random element = ytterbium
</pre>
===version 2===
Slightly simplified:
<br><br>Note that this version doesn't work (recieves a syntax error 12) with REXXes that have a
<br>smaller limit of the total length of a clause, in particular PC/REXX and Personal REXX
<br>which have a limit of 1,000 characters).
<lang rexx>
/* REXX ***************************************************************
|