samedi 6 mai 2017

Error: "cannot implicitly convert type 'int' to 'bool' "

Hi I have this code and it is keep saying that "cannot implicitly convert type 'int' to 'bool' " for every each "month = 1", "month = 2" etc... Can someone help?

   `public static string NumberToMonth(int month)
    {
        if (month = 1)
            return "január";
        if (month = 2)
            return "február";
        if (month = 3)
            return "március";
        if (month = 4)
            return "április";
        if (month = 5)
            return "május";
        if (month = 6)
            return "június";
        if (month = 7)
            return "július";
        if (month = 8)
            return "augusztus";
        if (month = 9)
            return "szeptember";
        if (month = 10)
            return "október";
        if (month = 11)
            return "november";
        if (month = 12)
            return "december";        
        else
            return "";`

Aucun commentaire:

Enregistrer un commentaire