Remember: void
means your method doesn’t return a value, so it cannot be assigned to other variable or passed to method as an argument like WriteLine
method:
this is what you’re looking for:
class Program
{
static void Main(string[] args)
{
Console.WriteLine("what is num?");
int num = int.Parse(Console.ReadLine());
downnums(num);
}
public static void downnums(int num)
{
if (num == 0)
Console.WriteLine("that all");
else
{
Console.WriteLine(num);
downnums(num-1);
}
}
}
solved C# Argument 1: cannot convert from ‘void’ to ‘bool’ [closed]