title: Method to return to beginning of function
body: <p>Does C++ have any type of utility to return to the beginning of a function after a function call? For example, example the call to help() in the calculate function.</p>
  
  <pre><code>void help()
  {
       cout &lt;&lt; "Welcome to this annoying calculator program.\n";
       cout &lt;&lt; "You can add(+), subtract(-), multiply(*), divide(/),\n";
       cout &lt;&lt; "find the remainder(%), square root(sqrt()), use exponents(pow(x,x)),\n";
       cout &lt;&lt; "use parentheses, assign variables (ex: let x = 3), and assign\n";
       cout &lt;&lt; " constants (ex: const pi = 3.14). Happy Calculating!\n";
       return;
  }
  
  void clean_up_mess()        // purge error tokens
  {
      ts.ignore(print);
  }
  
  const string prompt = "&gt; ";
  const string result = "= ";
  
  void calculate()
  {
      while(true) try {
          cout &lt;&lt; prompt;
          Token t = ts.get();
          if (t.kind == help_user) help();  
          else if (t.kind == quit) return;
          while (t.kind == print) t=ts.get();
          ts.unget(t);
          cout &lt;&lt; result &lt;&lt; statement() &lt;&lt; endl;
      }
      catch(runtime_error&amp; e) {
          cerr &lt;&lt; e.what() &lt;&lt; endl;
          clean_up_mess();
      }
  }
  </code></pre>
  
  <p>While technically my implementation of a help function works fine, it's not perfect. After help is called, and returns, it proceeds with trying to cout &lt;&lt; result &lt;&lt; statement() &lt;&lt; endl; which isn't possible because no values have been entered. Thus it gives a little error message (elsewhere in the program) and then proceeds on with the program. No problem with functionality, but it's ugly and I don't like it (:P). </p>
  
  <p>So is there any way for when the help function returns, to return to the beginning of calculate and start over? (I played around with inserting a function call in if(t.kind == help_user) block to call calculate, but as I figured that just delays the problem rather than solving it.)</p>