diff options
| author | Paul Buetow <paul@buetow.org> | 2013-02-03 10:44:49 +0100 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2013-02-03 10:44:49 +0100 |
| commit | 025e15b2ba7f54f87cf409fd7c3dd77746c72858 (patch) | |
| tree | 007c5af4f921aa85665f4db56f6f4309668a5dab /perl9.buetow.org/content/Extended-Features.sub/Infinite-Loops.xml | |
| parent | fc0acd318710aa0bb566329a36d886b1455c21ec (diff) | |
add hosts
Diffstat (limited to 'perl9.buetow.org/content/Extended-Features.sub/Infinite-Loops.xml')
| -rw-r--r-- | perl9.buetow.org/content/Extended-Features.sub/Infinite-Loops.xml | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/perl9.buetow.org/content/Extended-Features.sub/Infinite-Loops.xml b/perl9.buetow.org/content/Extended-Features.sub/Infinite-Loops.xml new file mode 100644 index 0000000..d8658b7 --- /dev/null +++ b/perl9.buetow.org/content/Extended-Features.sub/Infinite-Loops.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="ISO-8859-1" standalone="yes" ?> +<content> + <pagetitle>Perl 9 has now infinite loops!</pagetitle> + <text>Perl 9 supports an infinite loop which needs only 1 second of runtime. Which is faster than every other language needs to do this. This is possible because of very modern algorithms of the Perl 9 internals.</text> + <code> +#!/usr/bin/perl9 + +my $pi; +infinite { + $pi = calculate_pi; + say $pi; # Prints out THE EXACT number Pi! +} + + +# Will need infinite time to print Pi because not in the infinite loop! +say $pi; + </code> + <text>It is also possible to run several infinite loops in parallell using threads!</text> + <code> +my $pi; +my $code1 = infinite { + $pi = calculate_pi; + say $pi; # Prints out THE EXACT number Pi! +} +my $euler; +my $code2 = infinite { + $euler = calculate_euler; + say $euler; # Prints out THE EXACT number euler! +} + +Thread.new(code => $code1).run; +Thread.new(code => $code2).run; + </code> +</content> |
