+ 3
29th Aug 2017, 10:36 PM
Jose Hernandez Suarez
Jose Hernandez Suarez - avatar
3 Answers
+ 7
your function is both a void and an int but it can only be one of them and in your case it's need to be a void
29th Aug 2017, 11:03 PM
johan beimers
johan beimers - avatar
+ 2
The error was because you added an operator before your method name "sum" ...here's your code without errors using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SoloLearn { class Program { static void Sum(int x, int y) { Console.WriteLine(x+y); } static void Main(string[] args) { Sum(8, 6); } } }
29th Aug 2017, 11:42 PM
Nomeh Uchenna Gabriel
Nomeh Uchenna Gabriel - avatar
0
I go with what Johan said. You can't have a function return both none and a number. It has to be a void in your case.
29th Aug 2017, 11:14 PM
Gabriel Popa
Gabriel Popa - avatar