Compile-time calculation: Difference between revisions
Content added Content deleted
m (Added Sidef language) |
No edit summary |
||
Line 702: | Line 702: | ||
factorial 6 is 720 |
factorial 6 is 720 |
||
</lang> |
</lang> |
||
=={{header|PowerShell}}== |
|||
<lang PowerShell> |
|||
function fun($n){ |
|||
$res = 0 |
|||
if($n -gt 0) { |
|||
1..$n | foreach{ |
|||
$a, $b = $_, ($n+$_) |
|||
$res += $a + $b |
|||
} |
|||
} |
|||
$res |
|||
} |
|||
"$((Measure-Command {fun 10000}).TotalSeconds) Seconds" |
|||
</lang> |
|||
<b>Output:</b> |
|||
<pre> |
|||
0.820712 Seconds |
|||
</pre> |
|||
=={{header|PureBasic}}== |
=={{header|PureBasic}}== |