Loops Control with Python

Wijaya Edward ewijaya at i2r.a-star.edu.sg
Fri Oct 13 16:21:15 CEST 2006


Can we make loops control in Python?
What I mean is that whether we can control
which loops to exit/skip at the given scope.
 
For example in Perl we can do something like:
 
OUT:
foreach my $s1 ( 0 ...100) {
   
    IN:
    foreach my $s2 (@array) {
    
          if ($s1 == $s2) {
             next OUT;
          }
          else {
              last IN; 
          } 
 
     }
}
 
How can we implement that construct with Python?
 
-- 
Edward WIJAYA
SINGAPORE

------------ Institute For Infocomm Research - Disclaimer -------------
This email is confidential and may be privileged.  If you are not the intended recipient, please delete it and notify us immediately. Please do not copy or use it for any purpose, or disclose its contents to any other person. Thank you.
--------------------------------------------------------



More information about the Python-list mailing list