W
whatupbuttercup
If I had some code, with several if-then-else clauses, one of them
containing an empty block, would I need a semi-colon in that block?
What effect would a semicolon have?
I ask because I have inherited some code that contains such a
construct, and I'm not sure if the blatant semicolon is required, or
was just thought to be required.
EX:
if (something1)
{
// code here;
}
else if (something2)
{
// code here;
}
else if (something3)
{
// nothing here but comments
// do I need a ";" here?
// if there is one here, what effect, if any, does it have?
// does it short-circuit anything?
}
else if (something4)
{
// code here;
}
containing an empty block, would I need a semi-colon in that block?
What effect would a semicolon have?
I ask because I have inherited some code that contains such a
construct, and I'm not sure if the blatant semicolon is required, or
was just thought to be required.
EX:
if (something1)
{
// code here;
}
else if (something2)
{
// code here;
}
else if (something3)
{
// nothing here but comments
// do I need a ";" here?
// if there is one here, what effect, if any, does it have?
// does it short-circuit anything?
}
else if (something4)
{
// code here;
}