Dear Dyanmo experts:
Im trying to use if else, and tried to look it up online, and it didn’t work, I didn’t seem to catch the problem with my code, can anyone help me?
I have a list of points and I want to translate each points with different types of lists
there are two types of points I want to translated to
LC_P_X = [-10,-10,-5,-5,5,5,10,10]; (for x axis)
LC_P_Y = [0,4,4,5,5,4,4,0]; (for y axis)
HC_P_X = [-4,-4,4,4]; (for x axis)
HC_P_Y = [5,15,15,5]; (for y axis)
but I wanted to be trigger by strings [“a”,“b”,“c”,“d”,“e”] with if else
if I pick “a” then use LX_PY and LC_P_X to translate
if I pick “b”,“c”,“d”,“e” then use HC_P_X and HC_P_Y to translate
others will be null
I am kinda learning right now and I know that maybe I can use a?b:c to do this but I wanted to try to use the if else in order to let me understand about other things like while loop or for loop,
What does the error says?
sorry for missing the errors, the error says closeparen expected
I think there are at least two problems.
1, you don’t need return = [Imperative], you can just put [Imperative] there.
2, You cannot do x == a, b, c, d. It has to be x == a || b || c || d, see below:
Post withdrawn just means I was completely wrong with what I originally said and wanted it deleted from the history books
The || is the OR operator. It means if any of those conditions are true, the condition is true. A comma does not work and that is why there is an error (
closeparen expected - it was expecting the if statement to end with a parenthesis but you gave it a comma
sorry but Im new to this what does post withdrawn by author mean?
It just means that the author (kennyb6 in this case) has deleted his post
Wow it worked, Thankyou for the help, now I can move on Trying other thing many thanks!!