Question

5.6 - Discussion: Should Loops be Well-Disciplined, or... ...Should Programmers be able to use “GO TO”...

5.6 - Discussion: Should Loops be Well-Disciplined, or...

...Should Programmers be able to use “GO TO” statements as they please?

Some programming languages require that a loop only have one way in, and one way out; there are no “GO TO” statements. Other languages (like BASIC and FORTRAN) allow for statements to have “labels”, or addresses, that another statement like a GO TO can explicitly transfer control.

Discussion: What do you see as the strengths and weaknesses of each of these approaches? Would you rather work in a strongly disciplined language, that only lets you exit your loops by “falling out the bottom of them” when their control variable or interaction conditions say “I’ve had enough?” Do GO TO statements appeal to you?

Additionally, what special hazards might the programmer find when starting to combine IF, CASE, or other conditional logic on top of or inside of their loops?

0 0
Add a comment Improve this question Transcribed image text
Answer #1

The benefits of GOTO were as follows:

  • It is functionally identical to an instruction found in all CPUs (and their assembly languages) - sometimes called JUMP/JMP or BRANCH (BR) - or even GOTO. It’s an unconditional change in program flow. It is as easy to implement in a high level language (like Fortran or C) as it is in assembly language, and is easy for a programmer familiar with assembly language to understand.
  • It allows manual code-folding (which is still useful), such as entering cleanup code at various different places - or entering common initialization code.
  • With GOTO and a simple IF <condition> STATEMENT form, you can implement other flow-control possibilities, such as IF/THEN/ELSE, loop exiting statements (like “break” in C), loop repeating statements (like “continue” in C/C++), and iterative loops.
Add a comment
Know the answer?
Add Answer to:
5.6 - Discussion: Should Loops be Well-Disciplined, or... ...Should Programmers be able to use “GO TO”...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Identify 8 issues in regards to Recruitment and Selection, 3 issues for Labour Relation in the...

    Identify 8 issues in regards to Recruitment and Selection, 3 issues for Labour Relation in the following case study : You have recently been hired as an HR Consultant in the new HR Department of Outrage Video Games. Outrage is a five year old, upstart company, run by two very bright young men - Will Bates – President, and his best friend Steve Cobbs, Vice President. This is a very exciting change for you because Outrage, which literally started in...

  • Distinguishing Between Inferences and Assumptions To be skilled in critical thinking is to be able to...

    Distinguishing Between Inferences and Assumptions To be skilled in critical thinking is to be able to take one’s thinking apart systematically, to analyze each part, assess it for quality and then improve it. The first step in this process is understanding the parts of thinking, or elements of reasoning. These elements are: purpose, question, information, inference, assumption, point of view, concepts, and implications. They are present in the mind whenever we reason. To take command of our thinking, we need...

  • Hello I need help with this program. Should programmed in C! Program 2: Sorting with Pointers...

    Hello I need help with this program. Should programmed in C! Program 2: Sorting with Pointers Sometimes we're given an array of data that we need to be able to view in sorted order while leaving the original order unchanged. In such cases we could sort the data set, but then we would lose the information contained in the original order. We need a better solution. One solution might be to create a duplicate of the data set, perhaps make...

  • Case study Company Case Campbell Soup Company: Watching What You Eat You might think that a well-known, veteran consumer products company like the Campbell Soup Company has it made. After all, when pe...

    Case study Company Case Campbell Soup Company: Watching What You Eat You might think that a well-known, veteran consumer products company like the Campbell Soup Company has it made. After all, when people think of soup, they think of Campbell’s. In the $5 billion U.S. soup market, Campbell dominates with a 44 percent share. Selling products under such an iconic brand name should be a snap. But if you ask Denise Morrison, CEO of Campbell, she’ll tell you a different...

  • CASE 20 Enron: Not Accounting for the Future* INTRODUCTION Once upon a time, there was a...

    CASE 20 Enron: Not Accounting for the Future* INTRODUCTION Once upon a time, there was a gleaming office tower in Houston, Texas. In front of that gleaming tower was a giant "E" slowly revolving, flashing in the hot Texas sun. But in 2001, the Enron Corporation, which once ranked among the top Fortune 500 companies, would collapse under a mountain of debt that had been concealed through a complex scheme of off-balance-sheet partnerships. Forced to declare bankruptcy, the energy firm...

  • What an Executive Summary Is An executive summary is a specific type of document that does...

    What an Executive Summary Is An executive summary is a specific type of document that does two things: it summarizes a research article, and it offers recommendations as to how information from the article can be used. Some long reports can contain an executive summary section, as indicated in the Pearson handbook. Write a 2 pahe Executive Summary In business contexts, an executive summary is always written for a specific purpose: to explain the information in the article to a...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT