Print out even numbers with a do...while loop : Do While « Statement « Perl






Print out even numbers with a do...while loop



#!/usr/bin/perl

use warnings;
use strict;

my $n = 0;
do { 
  {
    next if ($n % 2);
    print $n, "\n";
  } 
} while ($n++ < 10);

 








Related examples in the same category

1.Using the do/while repetition structure
2.Do .. while statement
3.A do statement.
4.The do/while and do/until Loops