Consider this snippet:
private void button1_Click(object sender, EventArgs e)
{
if (textBox1.MaxLength > 0)
{
textBox2.Text = Convert.ToBoolean(Math.Sqrt(textBox1.MaxLength)).ToString();
}
else if (textBox1.MaxLength < 32768)
{
textBox2.Text = Convert.ToBoolean(Math.Sqrt(textBox1.MaxLength)).ToString();
}
}
Why is it not evaluating the second condition (the lesser than condition)? It’s also true, isn’t it?
If I have to make the second one to work in the same condition, what minor change must be made?
else ifis only checked if the first condition isn’t satisfied.If you want both of them to be true, you should do