Jump to content

Loop structures: Difference between revisions

Added Perl
(Added Pascal)
(Added Perl)
Line 112:
procedure2;
END;
 
==[[Perl]]==
[[Category:Perl]]
 
===while===
 
'''Interpreter:''' [[Perl]] 5.8.8
#!/usr/bin/perl -w
use strict;
my $condition1 = 0;
while ( $condition1 ) {
# Do something.
# Remember to change the value of condition1 at some point.
}
 
===do-while===
 
'''Interpreter:''' [[Perl]] 5.8.8
#!/usr/bin/perl -w
use strict;
my $condition1 = 0;
do {
# Do something.
# Remember to change the value of condition1 at some point.
} while ( $condition1 );
===until===
 
'''Interpreter:''' [[Perl]] 5.8.8
#!/usr/bin/perl -w
use strict;
my $condition1 = 1;
until ( $condition1 ) {
# Do something.
# Remember to change the value of condition1 at some point.
}
 
 
===do-until===
'''Interpreter:''' [[Perl]] 5.8.8
 
#!/usr/bin/perl -w
use strict;
my $condition1 = 1;
do {
# Do something.
# Remember to change the value of condition1 at some point.
} until ( $condition1 );
Cookies help us deliver our services. By using our services, you agree to our use of cookies.