help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Breaking out of a foreach loop


From: Noel Yap
Subject: Re: Breaking out of a foreach loop
Date: Fri, 27 Feb 2004 19:04:11 -0500

I had forgotten about this technique.  IIUC, it's pretty similar to using 
recursion to emulate a counted for loop within a functional programming 
language.  Is this what you were going for?

Noel

Mike Gibson wrote:
> 
> Here's a first pass...Not tested as I don't care that much.
> 
> restwords = $(wordlist 2,$words($(1)),$(1))
> 
> # $(1) : word list
> # $(2) : break function
> # $(3) : statement
> for_with_break = $(if $(call $(2),$(firstword $(1))),
>         $(3) $(call f,$(call wordlist,$(1))))
> 
> $(call for_with_break,$(DIRS),some condition function,some statement)
> 
> On Friday 27 February 2004 03:45 pm, Bhatt, Milan C wrote:
> > Hi Guys,
> >
> > I just had a quick question on whether there was any way to break out of
> > a foreach loop when a certain condition has been reached.
> >
> > I'd like to do the following:
> >
> > $(foreach dir, $(DIRS), \
> >         $(if <condition>,   <statement>; \
> >                                        <break_out_of_loop>) )
> >
> > I wasn't able to find anything in the documentation that provided this
> > kind of functionality.
> >
> > Thanks,
> > Milan
> 
> _______________________________________________
> Help-make mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/help-make

-- 
NOTICE: If received in error, please destroy and notify sender.  Sender does 
not waive confidentiality or privilege, and use is prohibited.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]