Exit/Break each

1,213 views
Skip to first unread message

Andre Bocati

unread,
Feb 1, 2014, 7:41:32 AM2/1/14
to jad...@googlegroups.com
Hey guys,

Is it possible to quit, break, exit a each in jade if i find a condition?

For example:

each friend in friends
   if (friends == "TEST")
   break;


is it possible?????

Forbes Lindesay

unread,
Feb 1, 2014, 7:44:54 AM2/1/14
to <jadejs@googlegroups.com>
You could try

    - break;

Since the loop is just a js for loop
--
You received this message because you are subscribed to the Google Groups "Jade" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jadejs+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Andre Bocati

unread,
Feb 1, 2014, 7:58:07 AM2/1/14
to jad...@googlegroups.com
Thanks Forbes,

Just a quick one....

Not having luck with variables.

      each friend in friends 
          if (friends == "TEST")
               found = true
          break;

if (found === true)
    showThatImage


Can i use variables like that? Not having luck at all with that..... i just want to show the image if the TEST was found in my each...

Thanks....
Message has been deleted

tomas...@siteone.cz

unread,
Nov 18, 2015, 3:57:39 AM11/18/15
to Jade

try

if (friends == "TEST")
    -found = true

when u want to use JS in Jade u have tu start with "-", so Jade knows its JS

Vishal Wankhede`

unread,
Dec 18, 2015, 3:22:19 AM12/18/15
to Jade
Thanks... worked for me.
Reply all
Reply to author
Forward
0 new messages