What does "return" do in C#?

public static BankAccount openBankAccount(string owner, double balance, double allowed)
{
BankAccount account;
account = new BankAccount();
account.owner = owner;
account.balance = balance;
account.allowed= allowed;
return account;
}

2014-04-03T13:59:31Z

Why does it return it? What is the meaning of returning? We don't see anything of it when the program is running. Thank you very much.

R.A.K.2014-04-04T07:17:46Z

Favorite Answer

The statement "return account" returns the the 'account' object to the method from where the call was made. You can store this 'account' object in another object of 'BankAccount' type and copy the reference of this 'account' in that object for using it in the caller method.

?2014-04-03T20:43:15Z

It returns the instance of BankAccount (account) back to the caller of the method.