In "Go" straight out of ASM or any other assembly language. Here's a link: I want to know: what can do this and make my code more how I can do it in this larger project without cheering up. Since the goto statement allows you to jump back and forth, the occasional, infinite loop waits if this happens in the wrong way. Can be in one such example? Editor: Well, I've seen an answer to Codego.net, apparently widespread about the "GOTO", which is bad. So I've been thinking: why is PHP trouble adding it to that language? If they don't see it in there, they won't do it ... Why? In addition: A stackoverflow here generally about "go to" EDIT2: see as this problem caused a lot of bad things to be sad I go and ask my father's jump. He is 52 years old and an engineer. He was a couple of his days, mostly in FORTRAN and COBOL programming made a good amount. Today he does it services, servers and with this class. Anyway, he said those about "back to my day ..." After that, he turned to say that even as early as a student in his day, they were sorry to know that it was not a clever idea, but they did not have a better situation at the time. Try/catch is still a few years of time and error handling almost excisted. So you did a check on what your program is? Adding a few lines at the end lets you print out everything you need to check your code, and then you put the lines: "Go to print;", or similar, start printing your data. And in this way, you slowly debug your code. He agreed to go in the modern programming world where he found it reasonable to be an "emergency interruption" in debugging and unexpected situations. A bit like Goto fatal_error, and for your code "is Fatal_error" part of the thing to show you the depth of the results. However, only in the creation of the final product should there be no jump-late edit: Another in php5.3/php6 about "go to"
1. If you are writing good PHP code, you should not need to jump. I think this is a mistake and they are adding it in as it just leads to lazy programming. Look for a good on the add this to PHP, and, here's the stack Overflow,
2. I've only found a goto: the nested loop that was punched out. But most new languages have to do this without goto anyway (break <number> codego.net in PHP, or break <loop label> in Java, and so on). Go to the end of a function to clean up the section. But again, it's not in a garbage collection language. In other words, if you don't know if you goto you shouldn't.
3. There is no such thing as a jump. Maybe, just maybe, it might get out of multiple nested loops, but you can already do "break 2" like that. tags are as good as in Java for this purpose. Perhaps it is with code-writing exceptions when you need to jump to a heap at the end of one of the failures. But that's just a crappy code for fixing crappy code.
4. It can be used for debugging purposes, so you don't have to go out or code refactoring blocks just to temporarily change the worker thread.
5. In the classic VB encoding, using Goto is handy for simulation of Try/catch error handling:
function MyFunction () as String '--start of error block ' On Error Goto Catch ' Do som Ething here this might cause an error MyFunction = "IT worked" Exit Function Catch: ' Error occured-do something else My function = Err.Description '--end of error blockend Function ... Here is a simulation of the Try/catch/finally. Function MyFunction () as String '--start of error block ' On Error Goto Catch ' does something here, might cause an error MyFunction = "IT worked" Goto Finally Catch: ' Error occured-do something else MyFunction = Err.Description Err.Clear F inally: ' Put your finally code here '--end of error blockend Function
It can also be used to clear at the end of a function, although I think you can do another function that can be called to do this cleanup situation. To be honest, I've never been in PHP, and I thought: "Well, I wish I could have a goto I didn't have to do this for them why they decided to do this, but, those guys are very smart and have the opportunity to think about PHP in a very good direction so far, so maybe just looking forward to it, we don't know."
6. I have a cross-lingual port that I see in the language using Goto. I write the parser generator in the C language to generate the parser and goto statement (it is easier to use goto than the more sensible control structure), and now porting it to PHP is not so much of a headache.
7. When writing a finite state machine, Goto is. When parsing the context frees you really need one of them. Although we can live without jumping, if continue $case; is a switch block valid jump to a different situation and close the process of having the case range as many languages nowadays as there are. Before that, we were almost stuck in Goto.
8. Jumps can help reduce code duplication of stack unwinding, in the following pseudo-code:
Do Aif (Error) goto Out_a;do Bif (Error) goto Out_b;do Cif (Error) goto Out_c;goto Out;out_c:undo Cout_b:undo B:out_a:undo Aout:return ret;
(Pseudo-by Robert Love, the mailing list archived from the Linux kernel takes code:)
9. As has been said before, Goto is the only really needed type of algorithm, usually those in language parsing or finite state machines. I have never missed a goto statement in PHP. OTOH, I have a language where only two of the structures are functions and conditions Goto method: SNOBOL4. Since the risk of spaghetti code is so high, the most SNOBOL4 is/very careful to avoid this. But Goto statement also makes very tight programming, creative loop execution and so on. It is actually easier to do an FSM ring if you have a goto in use.
10. I admit I transferred to my code. :) The only reason seems to favor the 2nd phase of porting in the shortest flyway from other languages to PHP (which actually only changes the language without touching the control structure) and refactoring the code. I personally think that with colleagues, because they can avoid conditional break-s loops, they will be able to resist the temptation to turn.
11. The generated code can make a goto statement, I guess. The benefit to the generated code is that you don't need to maintain it-you just regenerate it.
The Goto really should be in spite of the language and will go out of date due to better programming practices. Adding it now seems like a step backwards. The major advantage of the
Goto statement is the learning curve. People can't help asking why the tools like Visualstudia and Mac computers are doing well. The reason is that people need more than just a great product and they want to have a great product that they can learn in just one hours or so. Now many a day is only planned for one of their jobs. I see so many books saying that a person can never use a goto statement and then give five or so technology, for example, they say every elimination needs it. I said, just the fact that 5 is how much better to prove it!! I did not teach five things, including abnormal structure, to explain the whole chapter!! When what you really need is a simple jump that can be explained within 30 seconds. Of course, you can create malicious code with them if you want to---but, hey, most don't want to write bad code if they can. The most goto statement is simple to understand and learn from the code in our labs, much more than reading a 2000-page book.