for / while else doesn't make sense
Ian Kelly
ian.g.kelly at gmail.com
Thu Jun 2 16:46:46 EDT 2016
On Thu, Jun 2, 2016 at 2:09 PM, Rob Gaddi
<rgaddi at highlandtechnology.invalid> wrote:
> The limited variable scoping is the only thing missing, and you can get
> around that by telling yourself you're not going to use that variable
> again, and then believing you on the matter.
Or you can actually limit the variable scope using a function:
def the_loop():
for loopvar in range(initial_value, limit+1):
processing
if found_what_im_looking_for:
return it
do_whatever_it_is_you_do_when_its_not_found
thing_i_was_looking_for = the_loop()
More information about the Python-list
mailing list