trancor
09-20-2007, 06:50 PM
Hey, I'm having some trouble getting switch statements to work in python.
If I have -
x=1
switch x:
case '1':
print("Poo")
case '2':
print("Goob")
it gives me this as an error -
# Error: ('invalid syntax', ('<maya console>', 5, 8, 'switch x:\n'))
# File "<maya console>", line 3
# switch x:
# ^
# SyntaxError: invalid syntax #
If the carrot isn't pointing to the x, it was in the error
Now I've tried -
switch x:
switch 'x':
switch "x":
switch (x):
switch ('x'):
And every time maya either doesn't like the : or the digit after the x.
If anyone knows how to get switches in python working, I think you in advance
If I have -
x=1
switch x:
case '1':
print("Poo")
case '2':
print("Goob")
it gives me this as an error -
# Error: ('invalid syntax', ('<maya console>', 5, 8, 'switch x:\n'))
# File "<maya console>", line 3
# switch x:
# ^
# SyntaxError: invalid syntax #
If the carrot isn't pointing to the x, it was in the error
Now I've tried -
switch x:
switch 'x':
switch "x":
switch (x):
switch ('x'):
And every time maya either doesn't like the : or the digit after the x.
If anyone knows how to get switches in python working, I think you in advance
