C#C
C#3y ago
moshimoshi

❔ use of args in method

can someone explain the specific context in which we declare args in the methods?
e.g. for this method - no args are declared whereas for another mtd where new variables are introduced, args are declared.

Here's code:
public bool TransferTo(double amount, Account another)
    {
        bool isWithdrawOk = Withdraw(amount);

        if (isWithdrawOk)
        {
            another.Deposit(amount);
            return true;
        }
        else return false;
    }

public void CreditInterest()
    {
        var interest = CalculateInterest();
        Deposit(interest);
    }
Was this page helpful?