Hello, according to the official documentation I should remove the word return to solve the problem, but it is absurd, because if I want to show it, how will I remove the return? How do I solve it? Thank you.
Main()
within that class?Really? That screenshot you have above shows an error CS0161 as the fourth error.it doesn't throw me the mentioned error
look thisIt's because you pasted the code into one of your methods and you are using on old version of the framework, which the makes you use an old version of the C# language which does not support local functions.
Are you sure you put in the code into a class? Or did you put it into theMain()
within that class?
namespace PRUEBAERRORES
{
class ERRORES
{
public static int Main() // CS0161
{
int i = 5;
if (i < 10)
{
return i;
}
else
{
// Uncomment the following line to resolve.
// return 1;
}
}
You're right, but it shows other additional errors, why? Take a look here, uncomment the line they indicate, it throws other errors, for exampleReally? That screenshot you have above shows an error CS0161 as the fourth error.
Faithfully promise that uncommenting that line does not then cause those other errors to appear. Those errors were always thereuncomment the line they indicate, it throws other errors, for example
Probably because you were rushing, and didn't fully copy the whole code, so you missed off the last two }but it shows other additional errors, why?
public class Test
{
public static int Main() // CS0161
{
int i = 5;
if (i < 10)
{
return i;
}
else
{
// Uncomment the following line to resolve.
// return 1;
}
}
}
Yes, sorry, you're right, it's crazy that this has taken so long. Don't think it's cute for me, on the contrary.Here's an idea. How about you stop posting screenshots of text in a language other than English and expecting us to either know what it says or type it into a translator ourselves? Stop posting pictures of text. If a screenshot adds value then post that as well but ALWAYS post code and error messages as text, formatted appropriately. If the text you have is in a different language, YOU translate it into English for us. In post #22, you've posted a screenshot of two error messages that refer to line 27 and yet the code doesn't even show line 27. You may not be going out of your way to make this more difficult for us but you're definitely not making any effort to make it easier. Start putting some thought into what you post and maybe we wouldn't have to waste so much of our time and yours. It's crazy that something so basic has taken so long to address but it's because you haven't made a clear post about the problem.