When I first started to learn programming I remember having an argument with my teacher about If Else statements. I was arguing that:

 if {
      ...
 } else if {
      ...
 } ...

is basically the same as:

 if {
      ...
 else {
      if {
           ...
      } else {
           if {
                ...
           } else {
                ...
           }
      }
 } 

but he said they were completely different. After a while of arguing I accepted they are different. Now, over the years I have come back to this and looked over them to see the apparent major difference but for the life of me I cannot see it.

Can someone please clarify why exactly they are different (apart from the obvious nesting)

没有正确的解决方案

许可以下: CC-BY-SA归因
scroll top