Compile-time calculation: Difference between revisions
Content added Content deleted
m (Added Sidef language) |
|||
Line 760: | Line 760: | ||
writeln(factorial); |
writeln(factorial); |
||
end func;</lang> |
end func;</lang> |
||
=={{header|Sidef}}== |
|||
The compile-time evaluation is limited at a constant expression, which cannot refer at any other user-defined data, such as variables or functions. |
|||
<lang ruby>define n (10!); |
|||
say n;</lang> |
|||
or: |
|||
<lang ruby>define n (func(n){ n > 0 ? __FUNC__(n-1)*n : 1 }(10)); |
|||
say n;</lang> |
|||
=={{header|Tcl}}== |
=={{header|Tcl}}== |