I run this program but it does not assign the value of or 3 to s, instead before running it gave the sintax error unassigned local variable 's'

        private void button1_Click(object sender, EventArgs e)
            int i, y, s;
            i = 8;
            y = 6;
                if (i == 6)
                    s = y;
                   s = 3;

i ve tested your code and it works, by the way put a semicolon after your last line of code altouhg i think that this is not the problem.


I put the semicolon forgot it when I pass to this site.

Thank you you are correct.