That's sort of what that does, it's just not very good. What you're looking for is called asynchronous (or event-driven) execution. Here's a good explanation of asynchronous and synchronous execution:
http://www.bisque.com/help/CCDSoft/asynchronous_vs._synchronous_execution.htm
The code I posted above is actually executed synchronously* but I used the
goto
statement to obscure that and make it look like it's executed asynchronously. Just as a note;
goto
should not be used like that under normal circumstances. It's best to avoid it as much as possible, because a lot of the time it can be confusing (like in my code above). It's okay to use it as a joke like that, but in real code it should normally be avoided. There are situations where using it is good, if not better than the alternatives, but that doesn't happen often.
*Technically all programs on modern CPUs are executed asynchronously; the CPU breaks down instructions into smaller steps, and then it executes all of the instruction step-by-step, almost in parallel. For example, if you have ten instructions that can each be broken down into 5 steps, you could do step 1 of each instruction first, then step 2 for each instruction, and then step 3 and so on. The CPU makes sure to do it in such a way that it gives the impression that the instructions were executed one-by-one like you might expect. It's called instruction pipelining and it's usually faster to do it that way. The Wikipedia article at
http://en.wikipedia.org/wiki/Instruction_pipeline is better at explaining than I am.