This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Strengthen weak refs when sorting in-place
[perl5.git] / t / base / while.t
1 #!./perl
2
3 print "1..4\n";
4
5 # very basic tests of while
6
7 $x = 0;
8 while ($x != 3) {
9     $x = $x + 1;
10 }
11 if ($x == 3) { print "ok 1\n"; } else { print "not ok 1\n";}
12
13 $x = 0;
14 while (1) {
15     $x = $x + 1;
16     last if $x == 3;
17 }
18 if ($x == 3) { print "ok 2\n"; } else { print "not ok 2\n";}
19
20 $x = 0;
21 while ($x != 3) {
22     $x = $x + 1;
23     next;
24     print "not ";
25 }
26 print "ok 3\n";
27
28 $x = 0;
29 while (0) {
30     $x = 1;
31 }
32 if ($x == 0) { print "ok 4\n"; } else { print "not ok 4\n";}
33