answersLogoWhite

0

Using "goto", even in languages where it is available, is generally considered bad programming practice.

User Avatar

Wiki User

13y ago

What else can I help you with?

Related Questions

Does java have goto?

Because goto statements usually result in hard to read code. This was a feature of C++ which the creators of Java decided they didn't want to allow.


How do you learn core java?

Goto a institute near by which teaches java and join in a batch......


Why goto keyword not used in java?

Goto leads to morememory waste age and multiple branching occurs so memory is wasted


What is the Meaning of go to statements in c?

A 'goto' statement is an unconditional requirement to go to that part of the program. As such, statements like these cause programs to become unstructured and should be avoided if possible. Goto statements lead to some sloppy and unreadable logic.


What are different types of control statements available in c?

1. goto, break, continue, return 2. if-else, switch-case-default 3. while, for, do-while


What is the pane in which the Java programming statements are located called?

The pane in which the Java programming statements are located is called


What are the three looping statements in java PL?

There are 4 different looping statements in Java. They are:While loopDo-While loopFor loopFor Each loop


What are the statements in java?

There are many kinds of statements that are used in Java and they are predominantly used for database connectivity using JDBCEx:PreparedStatement - for normal SQL QueriesCallableStatement - for stored procedures


What is go-to unconditional in c plus plus?

An unconditional goto is a goto that has no associated conditional expression. The following example demonstrates conditional and unconditional goto statements. int x=rand(); if (x) goto label_1; // conditional goto (when x is non-zero) else goto label_2; // conditional goto (when x is zero) label_1: // ... goto label_3; // unconditional goto (jump past label_2) label_2: // ... label_3: // ...


What is a method in Java?

A Java method is a sequence of statements. It is comparable to a function, subroutine, or procedure in other languages.


How many keywords in java 1.6?

As of Java 1.5, there are 50 keywords defined, 48 of which are used (const and goto are unusable keywords).abstractcontinuefornewswitchassertdefaultgotopackagesynchronizedbooleandoifprivatethisbreakdoubleimplementsprotectedthrowbyteelseimportpublicthrowscaseenuminstanceofreturntransientcatchextendsintshorttrycharfinalinterfacestaticvoidclassfinallylongstrictfpvolatileconstfloatnativesuperwhile


Why can't a goto statement be considered a looping structure?

A goto is an unconditional jump within the same procedure. Languages that do not support the notion of procedures (also known as subroutines or functions) are simply treated as being one large procedure. Regardless, the normal flow of execution within any one procedure is always from the top down, one statement after the other -- unless a goto is encountered. Goto statements allow the programmer to alter the flow of execution within a procedure. When a goto jumps backwards, this may result in statements that have already been executed to execute again. Every time that same goto is encountered, those same statements will execute over and over, thus creating a loop. However, a goto statement cannot be considered a loop because not all goto statements actually create loops. A goto statement that jumps forwards within a procedure rather than backwards cannot be considered a loop; it is bypassing code, not repeating it. By the same token, a goto statement that jumps backwards might begin executing a section of code that was previously bypassed by an earlier goto. So, without physically reading the code and following the flow of execution, there's simply no way to tell if a goto is a creating a loop or not. When a programming language supports structured looping statements, including for, for-each, while, do-while and repeat, then it becomes crystal clear that a loop really is being executed. While programmers can obviously use goto statements to create loops, there is no benefit in doing so. After all, code that is easy to read is also easy to maintain. If you want a loop, be specific and use the the appropriate loop structure. Although you should avoid using goto statements to create loop, that doesn't mean to say goto statements should be avoided altogether. For instance, when you have a nested loop (a loop within a loop) where you wish to break out of the outer loop from within the inner loop, a goto statement is by far the most efficient means of achieving that. Also keep in mind that in most cases a goto statement will be used in conjunction with an if statement which will decide whether the goto statement should be invoked or not, or perhaps to decide between two different goto statements. A switch structure extends this notion to cater for two or more goto statements, each of which is handled by a case label, thus giving greater structure and control over jumps.