Skip to main content
added 58 characters in body
Source Link
kzidane
  • 17.7k
  • 3
  • 28
  • 100

You should have written if(tower_height>=0 && tower_height<=23) { //body }

if(tower_height>=0 && tower_height<=23)
{
 //body
}

but if u write if(statement); { //body } this

if(statement);
{
   //body
}

this is a logical error . The

The body of if statement will run for sure irrespective of the if statement. your code can also be interpreted as: if(statement) { } //body

if(statement)
{
}
//body

You should have written if(tower_height>=0 && tower_height<=23) { //body }

but if u write if(statement); { //body } this is a logical error . The body of if statement will run for sure irrespective of the if statement. your code can also be interpreted as: if(statement) { } //body

You should have written

if(tower_height>=0 && tower_height<=23)
{
 //body
}

but if u write

if(statement);
{
   //body
}

this is a logical error .

The body of if statement will run for sure irrespective of the if statement. your code can also be interpreted as:

if(statement)
{
}
//body
Source Link

You should have written if(tower_height>=0 && tower_height<=23) { //body }

but if u write if(statement); { //body } this is a logical error . The body of if statement will run for sure irrespective of the if statement. your code can also be interpreted as: if(statement) { } //body