loop('x'){true}

50 views
Skip to first unread message

jstorm

unread,
Nov 13, 2012, 12:27:39 AM11/13/12
to gremli...@googlegroups.com
I am just watching Marko's talk on gremlin and I am a bit confused about how the loop works.
 
I am seeing a lot of example code where the first closure (whileFunction) is simply true: g.v(1).inE('child').filter{TextAnalysis.isMean(it.thinks)}.outV.loop(3){true}
 
Since the while closure determines when the loop will be stopped, in this case, does this mean we will end up with an infinite loop? In other words, if we set the whileFunction closure to always return TRUE, will gremlin know when to stop, or will he just keep traversing (looping) until the end of time?
 
Cheers :)
 

Marko Rodriguez

unread,
Nov 13, 2012, 9:51:40 AM11/13/12
to gremli...@googlegroups.com
Hi,

He will keep traversing until there are no more edges to traverse. Thus, not necessarily forever -- e.g. trees have endings.

HTH,
Marko.
--
 
 

Reply all
Reply to author
Forward
0 new messages