This is probably one of the weirdest errors I’ve come across so far.
private void BUEquals_Click(object sender, EventArgs e)
{
input2 = float.Parse(TBAnswer.Text);
if (choice == 0)
TBAnswer.Text = (input1 + input2).ToString();
else if (choice == 1)
TBAnswer.Text = (input1 - input2).ToString();
TBStored.Text = TBStored.Text + '-' + (input2).ToString();
else if (choice == 2)
TBAnswer.Text = (input1 * input2).ToString();
else
TBAnswer.Text = (input1 / input2).ToString();
input1 = 0;
}
Ever since I added line 9, line 10 has been shoving errors that I can’t make any sense of.
The “else” gets a red underline, saying that it’s an invalid expression term, and “if” gets a red underline saying that a semi-colon is expected.
Any ideas? I’ve honestly got nothing here. Thanks in advance!
EDIT: OK, turns out this is the most rookie-ish error I’ve ever made. Thanks for the help! Wonder how long it would have taken me to see that by myself…
You are missing { } around the second case statement.