Something is mission in If condition

Hi Everyone,
I have tried to put a logic into if condition however I thing I am mission something either brackets or something else please suggest.
“item.Contains(“months)”) Or item.Contains(“years)”) And varbool = true”

@manish0077 Try This :
item.Contains(“months") Or item.Contains(“years”) And varbool = true

2 Likes

same i used double quotes is for reference only

Remove the double quotes before item and at the end.

@manish0077

Could you please show me screenshot of expression you are trying here.

@manish0077 But you also had an extra ) after months :sweat_smile:

its not i am searching “months)”

image

@manish0077 Ohh, My Bad. Then It’s better if you tell us What error you get or send a Screenshot of the Error :sweat_smile:

@manish0077 There’s no error in the Expression , What do you Actually want to Do?

What is the type of “item”??

There is no error I just want the if condition to ignore the if condition when boolean value is false

string

I update the boolean value false still its going inside the then condition

@manish0077 I guess the Expression is right , and when varBool is False, It will go to Else Condition

Boolean expressions work in a similar way to order of operations (PEMDAS or your local variant)

“And” is like multiplying
“Or” is like adding.

So in your case you have

“2 + 2*5” (= 12)

You want " (2+2)*5" (= 20)

Hi @manish0077,

I hope varbool will always be there, that’s why you are using AND condition with this.

Then please try with the below syntax -
(item.ToString.Trim.Contains(“months”) OR item.ToString.Trim.Contains(“years”)) AND varbool=True

Hope it will help you.

Thanks & Regards,
Apurba

1 Like

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