esp8266 connect when starting to which AP?

Juraj:
Arduino/libraries/ESP8266WiFi/examples/WiFiScan/WiFiScan.ino at master · esp8266/Arduino · GitHub

I tried using the code from the GitHub example as follows:

case '9':   //Scan the WiFi networks
{
	SerialDebug.print("Starting WiFi network scan");
	//Put call here to scan and analyze the WiFi networks:
	// WiFi.scanNetworks will return the number of networks found
	int m = WiFi.scanNetworks();
	SerialDebug.println("Scan done");
	if (m == 0) 
	{
		SerialDebug.println("no networks found");
	} 
	else 
	{
		SerialDebug.print(n);
		SerialDebug.println(" networks found");
		for (i = 0; i < m; ++i) 
		{
		  // Print SSID and RSSI for each network found
		  SerialDebug.print(i + 1);
		  SerialDebug.print(": ");
		  SerialDebug.print(WiFi.SSID(i));// <== Gives argument error
		  SerialDebug.print(" (");
		  SerialDebug.print(WiFi.RSSI(i));// <== Gives argument error
		  SerialDebug.print(")");
		  SerialDebug.println((WiFi.encryptionType(i) == ENC_TYPE_NONE) ? " " : "*");
		  delay(10);
		}
	}
	strcpy(msg, "WiFi scan done");
	ReplyCmd(msg, strlen(msg));
	
}
break;  //subcmd 9

But I am getting "invalid arguments" on the SerialDebug.print lines shown above.
Something is amiss, I guess...