raganmd
6/4/2018 - 6:15 AM

touchdesigner-python-switch-statement-worst

def switcher(func_name, val1, val2):

    if func_name    == "Add":
        result      = val1 + val2

    elif func_name  == "Subtract":
        result      = val1 - val2

    elif func_name  == "Multiply":
        result      = val1 * val2

    elif func_name  == "Divide":
        result      = val1 / val2

    return result

print( switcher("Subtract", 1, 2) )