Im trying to learn C# from scratch and I have issue with one simple task. I cant understand why this is Not working,can you please explain me :
namespace ConsoleApplication1
{
class intro
{
static void Main(string[] args)
{
int i;
int j;
for (i = 1; j=-1; i <= 100 && j >= -100; i += 2, j -=2)
{
Console.WriteLine(i+j);
}
}
}
}
Edit: I missed why is NOT working, sorry for that. Semicolon instead of colon was the problem... Stupid question but thank you for patience.
There is a very common mistake, you placed `;' in the place ',';
for (i = 1, j=-1; i <= 100....
I don't know what you want to do with the code but it produce only '0' but the code is working as it should.