If condition not work

in result variable I am getting value rgb(255,0,0)
and I am applying condition if(result="rgb(255,0,0) ") this move to inside if condition but in my case it move else I also try this if(result=rgb(255,0,0)) but not work

Hi @Aditya10989

Scenario 1: Check first the value of result if it has a value.
2:Maybe if you can try it to messagebox if you want to see the result during runtime

Hope this might be helpful to you.:smiley: just reach out for the issue many thanks :smiley:

cheers :smiley:

Happy learning :smiley:

1 Like

HI @Aditya10989 ,

If the variable datatype is string then you can use result.contains(“rgb(255,0,0)”) it should works.

Thanks,
Mohanraj.S

1 Like


Please check screenshot. Better to use .Equals and without double quotes(").

1 Like

Hi
If this is the value we obtain
Then to be precise we can use a condition like this
result.ToString.Trim.Contains(“rgb(255,0,0)”)
The reason is might be failing due to some blank spaces either in front or back if the mentioned string
—if the above condition passes it will go to THEN part of if condition or not will go to ELSE part of if condition

Hope this would help you
Cheers @Aditya10989

1 Like

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