When do functions end.

I have a function that uses Network.Connect, does the function end only after FULLY completing Network.Connect, like if I would do if(!Network.isClient || !Network.isServer){
After the Network.Connect, and then Sent an error saying failed to connect to the console, would that work, or would the !Network.isClient, type statement call before fully finishing the Network.Connect?

Network.Connect starts the connection process, and some errors can be returned straight away - but generally the connection process goes on in the background, until eventually OnConnectedToServer gets called (or OnFailedToConnect).