Runtime evaluation: Difference between revisions
Content added Content deleted
m (added whitespace before the TOC (table of contents), added a ;Task: (bold) header.) |
m (→{{header|REXX}}: changed/added comments and whitespace, changed indentations.) |
||
Line 1,108: | Line 1,108: | ||
:::* run-time evaluation of an internal expression, and |
:::* run-time evaluation of an internal expression, and |
||
:::* run-time evaluation of a user-prompted expression. |
:::* run-time evaluation of a user-prompted expression. |
||
<lang rexx>/*REXX program illustrates ability to execute code entered at |
<lang rexx>/*REXX program illustrates the ability to execute code entered at runtime (from C.L.)*/ |
||
numeric digits 10000000 /*ten million digits should do it*/ |
numeric digits 10000000 /*ten million digits should do it. */ |
||
bee=51 |
bee=51 |
||
stuff= 'bee=min(-2,44); say 13*2 "[from inside the box.]"; abc=abs(bee)' |
stuff= 'bee=min(-2,44); say 13*2 "[from inside the box.]"; abc=abs(bee)' |
||
interpret stuff |
interpret stuff |
||
say 'bee=' bee |
say 'bee=' bee |
||
say 'abc=' abc |
say 'abc=' abc |
||
say |
say |
||
/* [↓] now, we hear from |
/* [↓] now, we hear from the user. */ |
||
say 'enter an expression:' |
say 'enter an expression:' |
||
pull expression |
pull expression |
||
say |
say |
||
say 'expression entered is:' expression |
say 'expression entered is:' expression |
||
⚫ | |||
interpret '?='expression |
interpret '?='expression |
||
⚫ | |||
say 'length of result='length(?) |
say 'length of result='length(?) |
||
say ' left 50 bytes of result='left(?,50) |
say ' left 50 bytes of result='left(?,50)"···" |
||
say 'right 50 bytes of result=···'right(?,50) |
say 'right 50 bytes of result=···'right(?, 50) /*stick a fork in it, we're all done. */</lang> |
||
/*stick a fork in it, we're done.*/</lang> |
|||
'''output''' when using the input: <tt> 2**44497 - 1 </tt> |
'''output''' when using the input: <tt> 2**44497 - 1 </tt> |
||
<br>which happens to be the 27th Mersenne prime. |
<br>which happens to be the 27th Mersenne prime. |