컴파일러 오류 CS0159

업데이트: 2007년 11월

오류 메시지

goto 문의 범위 내에 'label' 레이블이 없습니다.
No such label 'label' within the scope of the goto statement

goto 문이 참조하는 레이블을 goto 문의 범위 내에서 찾을 수 없습니다.

다음 샘플에서는 CS0159 오류가 발생하는 경우를 보여 줍니다.

// CS0159.cs
public class Class1
{
   public static void Main()
   {
      int i = 0;

      switch (i)
      {
         case 1:
            goto case 3;   // CS0159, case 3 label does not exist
         case 2:
            break;
      }
      goto NOWHERE;   // CS0159, NOWHERE label does not exist
   }
}