Why Switch case on String works without inverted comma and don't with inverted comma

I’m getting trained on basics of UI Path and came across an assignment where I had to use Switch

So I used like below and it was going in default case always.


After searching for it over and over I found that we should not use inverted comma for string. Tried that and it worked.

This is something different from my programming basics.

Can someone tell me why Switch case on String works without inverted comma and don’t with inverted comma?:robot:

The string value must always be in quotation marks. stopLightsColor is have to be a variable.

Please check the variables tab.

1 Like

Yes you Are Right
We need to mention the string literals without double quotes when we mention for case values

Even I have wondered in it many times
Cheers @ashokkarale

1 Like

Sorry but be careful here, all values must be WITHOUT the quotes there…

1 Like

The question was why Switch cases on String works without inverted comma.

The answer is Because cases act like arguments. This question has already been discussed here.

I did not immediately understand the question, but now the answer is accurate :nerd_face:


This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.