Tito Onowu

Tito Onowu

  • NA
  • 37
  • 8.8k

Jump statement

Nov 1 2013 3:36 PM
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)