2
Answers

Jump statement

Tito Onowu

Tito Onowu

11y
908
1
Hello kind teacher. Please what does it mean when the compiler say " Unreachable code detected"? I was trying to tell d program to list number 1 to 10 and write " I found 7" when it iterates to the number 7 and continues.


            int j;
            for (j = 0; j <= 10; j++)

                
            {

                if (j == 7)
                {

                    Console.WriteLine("Found 7");

                    continue;
                    Console.WriteLine(j + "\n");  


like this 

            int j;
            for (j = 0; j <= 10; j++)

                
            {

                if (j == 7)
                {

                    Console.WriteLine("Found 7");

                    continue;
                  

it only prints 7

Thanks


Answers (2)