Flow-control structures: Difference between revisions

m
No edit summary
m (→‎{{header|C++}}: lang tag)
Line 40:
=== goto ===
{{works with|GCC|3.3.4}}
<lang cpp> #include <iostream>
int main()
Line 47:
std::cout << "Hello, World!\n";
goto LOOP;
}</lang>
 
Note that "goto" may also be used in conjunction with other forms of branching.
Line 54:
{{works with|GCC|4.0.2}}
Exceptions are a way to give control back to a direct or indirect caller in case of an error. Note that throwing exceptions is usually very expensive, therefore they generally should only be used for exceptional situations.
<lang cpp> #include <iostream>
#include <ostream>
Line 124:
<< "inside foobar(). Thus this catch-all block never gets invoked.\n";
}
}</lang>
 
=={{header|Forth}}==