I know it's very basic, but I just started with programming. It would be about c #.
I want to count down from a number to 0 using 3 different loops that are in the same method (button1_Click). Can I use the and as a variable for the 3 loops?
private void button1_Click(object sender, EventArgs e)
{
int a = Int32.Parse(textBox1.Text);
for (int y = a; y >= 0; y--)
{
richTextBox1.AppendText(y.ToString());
}
int y=a;
while (y<=a && y>=0 ){
richTextBox2.AppendText(y.ToString());
y--;
}
do while{
int y=a;
richTextBox3.AppendText(y.ToString());
y--;
}(y<=a && y>=0);
}
Because in int y = a; tells me "Error 1 You can not declare a local variable named 'y' in this scope, because it would give a different meaning to 'y', which is already used in a 'secondary' scope with another denotation"
Thank you very much in advance.