prism/examples/prism-warpscript.html

23 lines
481 B
HTML

<h2>Full example</h2>
<pre><code>// Source: https://www.warp10.io/content/04_Tutorials/01_WarpScript/05_Best_Practices
//factorial macro. take a number on the stack, push its factorial
&lt;%
'input' STORE
1
1 $input &lt;% * %> FOR
%> 'factorial' STORE
//build a map with key from 1 to 10 and value = key!
{} 'result' STORE
1 10
&lt;%
'key' STORE
$result $key @factorial $key PUT
DROP //remove the map let by PUT
%> FOR
//push the result on the stack
$result</code></pre>