Check out example codes for "when can you use goto". It will help you in understanding the concepts better.

Code Example 1

// C++ program to check if a number is 
// even or not using goto statement 
#include <iostream> 
using namespace std; 
  
// function to check even or not 
void checkEvenOrNot(int num) 
{ 
    if (num % 2 == 0) 
    // jump to even 
        goto even;  
    else
    // jump to odd 
        goto odd;  
  
even: 
    cout << num << " is even"; 
    // return if even 
    return;  
odd: 
    cout << num << " is odd"; 
} 
  
// Driver program to test above function 
int main() 
{ 
    int num = 26; 
    checkEvenOrNot(num); 
    return 0; 
}

Learn ReactJs, React Native from akashmittal.com