Skip to content
Prev 305653 / 398506 Next

Can anyone help why the errors are coming and rectify it?

On 12-09-17 5:47 AM, Sri krishna Devarayalu Balanagu wrote:
The lines above are two complete statements.
The "else" is not allowed to start a statement.  You need to make sure 
the "if" is incomplete when you start the line containing else.  The 
usual style is

if (cond) {
   stmt1

# The if is still incomplete, because the closing brace is missing

} else {

# now the else will be accepted

   stmt2
}

Duncan Murdoch