Optional parameters: Difference between revisions

→‎{{header|REXX}}: added the REXX language. -- ~~~~
m (→‎{{header|OCaml}}: wiki link currying)
(→‎{{header|REXX}}: added the REXX language. -- ~~~~)
Line 1,324:
#:key (λ (row) (list-ref row column))))
</lang>
 
=={{header|REXX}}==
The REXX language allows for default values for positional arguments as well as an easy method to check if a string is part of a parameter.
<br>Also allowed are named parameters.
<br><br>The REXX language doesn't have any native sorting functions, so you have to write your own sorting subroutine.
<lang rexx>sortStrings: procedure expose @. /*stemmed array is named: @. */
arg col,order,options
reverse = wordpos('REVERSE',options)
if col='' then col=1
if order='' then order='LEXICOGRAPHIC'
 
... sort strings here ...
 
return</lang>
An example use is:
<lang rexx>/*REXX example to use the SortStrings subroutine with optional args. */
/*...define array (@.nnn) of strings here...*/
col=3
call sortStrings col,,'noReverse'
/*stick a fork in it, we're done.*/</lang>
 
=={{header|Ruby}}==