Concern about WiFi examples using "While (true) "

To develop a project with an UNO 4 WiFi, I am reviewing the examples included in the WiFiS3.h library.
All of them have routines in the setup section using lines like
while (true);

For example:

  if (WiFi.status() == WL_NO_MODULE) {
    Serial.println("Communication with WiFi module failed!");
    // don't continue
    while (true);
  }

This looks like a recipe for disaster, if you ever power up your board in an area with no WiFi.
This looks like an infinite loop.
Am I missing something?
I am trying to design a project that allows the user to optionally connect to WiFi. But work without it if there is none (Additional functions are available with WiFi).
I do not have a board to play with, I am just starting to get the code framework together, so I cannot test this yet.

Is my thinking correct? This will not move on unless it connects to WiFi?
Does anyone have any code examples for how long to keep trying to scan or connect before moving on instead?

Yes, the while( true); is an endless loop, but if the sketch requires WiFi but it is not possible to connect to it then it makes sense

Note that WiFi.begin is actually a blocking call on R4 WiFi, so many of the examples are incorrect with their WiFi.status() != WL_CONNECTED loops, at least "out of the box".

By default, it waits to connect for up to 10 seconds, which seems like enough.

WL_NO_MODULE should not literally be the case with R4 WiFi, but maybe there is some hardware issue, and it's just not going to work, even with retrying.

Thank you! OK, yes, just looked at the library code details and saw the 10 sec timeout code at the top.

It will not move on even if connection with the integrated WiFi module is reestablished.

The explanation is in the comment line just above the while statement ("don't continue"): the conditional is designed to pause execution forever if the condition is true.

Of course, forever is not really forever — you can always restart by pressing the reset button (or you can upload a different sketch).

Not "unless it connects to WiFI", WL_NO_MODULE refers to the inability to communicate with the WiFi hardware (ESP-32), which really should not be possible, given that the ESP32 is used for the USB to serial bridge on the UNO R4 WiFi, and its failure would render Serial inoperable, and the R4 unable to be programmed to begin with.

The library examples include that code because the library can be used on boards that do not have an integrated WiFi module.