Original issue: getting Serial.println("debug string") debug output is currently not working. So any type of debugging with usb-connection only is not happening.
edit: the serial monitor is showing something in the loop() but nothing in the setup().
Edit: adding delay(3000); into the setup() waits enough time to get the Serial.println("debug string") working inside setup().
I wonder why the setup() does not wait by default until all the default devices are setup and running.
Good.
That while() is required for any board with a physical USB chip onboard to make sure the USB serial is ready (i.e. if you don't have the USB connected). Only if the USB connection is not required for the sketch to run, don't add it.
It's useless for the other boards, but you can still keep it, as "Serial" always returns "true" for other boards, so the while() won't stop,
HOWEVER, if he ever wants to not use USB for power but a battery on VIN, the WHILE will never end. I AND that with a millis check in order to progress beyond the while.
while (!Serial && (millis() < 5000)) ; // Wait up to 5 secs for Serial to be ready