+ 1
Arrays and Classes
I created a class that is supposed to define a public array variable, and use a constructor to create an object in the main method by being passed as an argument. Also inside this class is a method that iterates through the int values inside the array and should only display them if they are even values. But it wonât compile, itâs not a method that uses a return statement so I made it void with an Iâd loop to check the conditional. Iâve been stuck on this for a day and a half and canât think of how I would go about changing this method to fix it. Class ArrTest and itâs method IsEven() are in question. https://code.sololearn.com/cTs0746Sa73K/?ref=app
3 Answers
+ 3
Replace line 67 with just this:
a1.IsEven();
Because your IsEven() function returns nothing, there is no value for Console.WriteLine to print.
+ 3
Oh wow, right over my head. Thank you both so much for pointing me in the correct direction : )