0
Condition
Does if and else condition stand together in code function?
3 Answers
+ 6
Like what Nahuel said, 'if' can stand alone while 'else' can only exist if 'if' exist.
... now that hurts my brain.
E.g.
if (x == 1)
{
//codes
}
is valid,
if (x == 1)
{
//codes
}
else
if (x == 2)
{
//codes
}
is valid,
else
{
//codes
}
is not valid.
+ 1
not sure what is "stand together" but there can not be an else without if.
+ 1
All else are if but not all if are else. lol