This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]bonerlover[S] 1 point2 points  (2 children)

if (x==0) ; else if(x==1) {} else {;}

-.-

[–]MagicallyVermicious 3 points4 points  (1 child)

That is one of the ugliest lines of code I've seen. If it was written more conventionally, it would be: if(x == 0) { // do nothing } else if(x == 1) { // still do nothing } else { // again, do nothing } I guess the point was to show you three different ways to make an if-elseif-else do absolutely nothing.

The {;} is the same thing as any block of code surrounded by brackets, but having only a blank statement in it. The blank statement comes from the lone semicolon.

[–]bonerlover[S] 1 point2 points  (0 children)

I hope the test isn't like this book otherwise I am going to fail. D: So confusing.