cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
665
Views
2
Helpful
2
Replies

How to do nested loop in lux

spudukko
Cisco Employee
Cisco Employee

i have tried to nest a loop within another loop in lux with two end loops.  But i got an error saying end loop missing.

    [loop i 1..$max_time]

          [loop j 1..$min_time]

          [endloop]

    [endloop]

1 Accepted Solution

Accepted Solutions

frjansso
Cisco Employee
Cisco Employee

You can work around this using a macro:

[macro inner]

[loop j 1..2]

!echo $j

[endloop]

[endmacro]

[shell test]

[loop i 1..2]

!echo $i

[invoke inner]

[endloop]

View solution in original post

2 Replies 2

frjansso
Cisco Employee
Cisco Employee

You can work around this using a macro:

[macro inner]

[loop j 1..2]

!echo $j

[endloop]

[endmacro]

[shell test]

[loop i 1..2]

!echo $i

[invoke inner]

[endloop]

Yes thanks for the reply. Thats what i ended up doing like the example in lux repo and like you showed using a macro. But was wondering if there any support for direct nesting

lux/loop_deep_fail.lux at master · hawk/lux · GitHub

Polls
AI-powered tools for network troubleshooting are likely to be part of everyone’s workflow sooner or later. What is the single biggest challenge or concern you see with adopting these tools in your organization?