Java do nothing

;

; is the empty statement. Usually, you don't need it - you can just put nothing in the brackets for an empty loop - but it can be useful.


I normally use something like:

"".isEmpty(); // do nothing

It's useful to be able to have a line of code which does nothing when debugging. You can put a breakpoint on that line, which is especially useful if it would usually be an empty block of code (e.g. empty catch block etc), as putting a breakpoint on an empty line can create confusion about where the breakpoint is actually set.


If you want something noticeable, you can use

assert true;

This will allow you to have something that a reader can recognize or that can be searched for.


Just use a semi-colon ;, it has the same effect.

Tags:

Python

Java