Exit program

How can i exit from the

  • python
  • python in dynamo
  • C# code (this need probably exit from application - not from programm)?

1.) example for python code in dynamo - if list IN[0] is empty - exit programm or exit from code (its just try)

check_inn= **break** if not IN[0] else do it...

2.)or how apply GOTO in python for example (this need ignore/skip -this part of code - > do it…)

check_inn= **goto label 1** if not IN[0] else do it...

do it...

label 1:


------ but in python 2.7 we cannot use this : from goto import with_goto

Maybe you could use try clauses

I have the below definition in one of my nodes, can that inspire you?
it has a statement where i use try clauses, if it fails, then it continues.

def find_index(lst, var, indices=[]):
    index = []
    for idx, items in enumerate(lst):
        if items == var:
            current_index = indices + [idx]
            if not any(isinstance(i, list) for i in items):
                    current_index = indices + [idx]
                    for i, val in enumerate(items):
                        if val == var:
                            index.append(current_index + [i])
                except BaseException:

            for item in items:
                if isinstance(item, list):
                    index.extend(find_index(items, var, indices[:]))
    return index

the definition is from the recursive code in the node IndexOf

1 Like