The first construction does not throw an error because that is valid code and compiles. It just does not do anything logically.
do while(false) will immediately exit the execution block so it will print nothing.
do while(false)