For example i want to write:
txt1.Text=="A" || txt2.Text="A" ? return true : return false
I know how to work with one condition but with two i don't know.
The txt2.Text="A" instead of txt2.Text=="A" it's not what i meant.
My question was how do i add a condition to this specific if. Yes, i know how to use in if.
the regular way to use in the other if is:
txt1.Text=="A"? return true: return false
and i want to improve that.
The code that i have written doesn't work.
Thank you
Are you looking for
return txt1.Text == "A" || txt2.Text == "A";
?
I think this is what you are looking for.
if(txt1.Text == "A" || txt2.Text == "A") //checks if txt1 is A OR txt2 is A
{
return true;
}
else
{
return false;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.