mercredi 25 avril 2018

How do I format the return within a method using an if statement?

What is the issue with the return type on this?

public static string Add(int num1, int num2)
{
    string temp;
    if ((num1 + num2) > 10)
    {
        string temp = "The sum of the two numbers is " + (num1 + num2);
    }
    return temp;
}

Aucun commentaire:

Enregistrer un commentaire