Difference between revisions of "Perl:Count 0 to 9"

From Progzoo
Jump to: navigation, search
(New page: <p>You can use a <code>for</code> loop to count from zero to nine.</p> ==Output 0 1 2 3 4 5 6 7 8 9== <question xmlns:htm="http://www.w3.org/1999/xhtml" lang="pl" className="Demo"><prog> f...)
 
 
Line 1: Line 1:
 +
{{topTenTips}}
 +
<question lang="pl" className="Demo">
 
<p>You can use a <code>for</code> loop to count from zero to nine.</p>
 
<p>You can use a <code>for</code> loop to count from zero to nine.</p>
==Output 0 1 2 3 4 5 6 7 8 9==
+
<prog>
<question xmlns:htm="http://www.w3.org/1999/xhtml" lang="pl" className="Demo"><prog>
 
 
for (my $i=0;$i&lt;10;$i++){
 
for (my $i=0;$i&lt;10;$i++){
 
   print "$i\n";
 
   print "$i\n";

Latest revision as of 02:25, 1 January 2008

You can use a for loop to count from zero to nine.

A more perlish solution:

for (0..9){
print "$_\n";
}
[Font] [Default] [Show] [Resize] [History] [Profile]