how to run the command automatically scan

hi,
I own one arduino uno and I want my program automatically initiates a scan wifi available, once the terminal launch.I looked in bookstores on running this command and I find the command sendCommand but I do not find how to use.
here is the beginning of my program.

if you have any ideas to solve my problem, I'm interested

Every example I've ever seen using while(!Serial) makes it VERY clear that nothing should be done until Serial communication is established.

Certainly putting a call to Serial.println() inside the block that is executed when the Serial instance is NOT ready does not make sense. So, why are you?

Copy and paste your code, don't take screen shots of it.

How to use this forum

What he means is, do this:

Serial.begin (9600);
while (!Serial) { }   // <----- don't do anything inside the brackets

Afterwards you can do Serial.println.

Serial.println command is to tell me where I am in the program during execution is.After reflection would be better now if a loop.
This program is designed to scan wifi available, then choose the one you want.but I do not see how to control the scan starts when the open terminal

#include <Debug.h>
#include <WiFly.h>
#include <WiFlyDevice.h>
#include <WiFlyServer.h>
#include <WiFly.h>
#include <SPI.h>

void setup() {
  
  Serial.begin(9600);
  WiFly.begin();
  Serial.println("launch control scan");
  if (Serial.begin==true) {
    
    Serial.println("scan starts");
    delay(2000);
  }
}
void loop(){
}
if (Serial.begin==true)

I've never seen Serial.begin used that way, are you sure that is correct usage? I'm pretty sure it's not as the library shows the function defined as void type thus returning no value.

Lefty

  if (Serial.begin==true) {

Serial.begin is a function. It won't be true. And doing that is not calling the function (no brackets).