QUIZGUM

Coding Class

Quizgum : goto

goto statement

This time, let's look at the goto statement.
The goto statement allows you to skip code.
there for example 1,2,3,4,5,6,7,8,9 length so I gadaga cross towards three two to cross the first I met goto 8 code.
Then you go straight to 8 without going through 4, 5, 6, 7.

How To Use goto

goto label(where to go);

label:

Label specifies the value you want.
I don't know how to use the above
Let's look at an example.

echo "quizgum step 1 <br>";
echo "quizgum step 2 <br>";
goto goSeven;
echo "quizgum step 3 <br>";
echo "quizgum step 4 <br>";
echo "quizgum step 5 <br>";
echo "quizgum step 6 <br>";
goSeven:
echo "quizgum step 7 <br>";
echo "quizgum step 8 <br>";
echo "quizgum step 9 <br>";

If you execute the above code, the output will be output till quizgum step 2, then goto goSeven statement, go to goSeven, and output from quizgum step 7.
So let's run the code

<?php
    echo "quizgum step 1 <br>";
    echo "quizgum step 2 <br>";
    goto go7;
    echo "quizgum step 3 <br>";
    echo "quizgum step 4 <br>";
    echo "quizgum step 5 <br>";
    echo "quizgum step 6 <br>";
    go7:
    echo "quizgum step 7 <br>";
    echo "quizgum step 8 <br>";
    echo "quizgum step 9 <br>";
?>

Execution result of the code above