goto statement in c#

By Super Man

How to use goto statement in c#

Lets see first one example for that:

        int x = 1;
   loop:
         if (x < 100)
        {
             x++;
            goto loop;
        }

here you need one lable which is used to transfer control using goto statement.

Here you need to take care of using goto statement.otherwise it goes in into infinite statement or skip some code always.

goto statement in c#  (1084 Views)