Welcome to Dream.In.Code
Getting Help is Easy!

Join 132,316 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,093 people online right now. Registration is fast and FREE... Join Now!




sequence structures

 
Reply to this topicStart new topic

sequence structures, Help understanding something

legend_018
post 22 Sep, 2008 - 05:20 PM
Post #1


New D.I.C Head

*
Joined: 11 Sep, 2008
Posts: 31

I hope this is the correct forum. I'm trying to learn the basics of programming.

There is something I'm not sure if I fully understand.

One of the general requirements of a sequence structure is that there may not be any branches or loops between the entry and the exit. This is the part I'm confused about. A psedocode example for sequence structues is:

enter
perform one or more actions in sequence
exit

There is also a note that says the action elements may themselves be sequence, selection or loop statements. I do understand this, I think. The code below shows that.

An example of this would be the Selection Structure in the code below, It is one of the elements in a sequence structure.

What would be an example (possibly using the code below) that would show me what it looks like to have a branch or loop that is NOT ALLOWED between the entry and the exit of the sequence structure? This code is from a program called Alice, which helps people learn the basics of programming. testResult and userInputValue are variables.

CODE

// Uses if-else to test a user input value for even or odd.
// Get user input.
userInputValue set value to ( ask user for a number question = Enter an integer. )
// Compute remainder after dividing by 2 and return true
// if remainder is equal to 0
testResult set value to ( ( IEEERemainder of userInputValue / 2 ) == 0 )
// Execute the selection structure.
If testResult
penguin say Even duration = 30 seconds
Else
penguin say Odd duration = 30 seconds


I guess I'm just trying to understand or visually see what it means when it says:
There may not be any branches or loops between the entry and the exit. This is the part I'm confused about. I'm taking a free tutorial that is online.

This post has been edited by legend_018: 22 Sep, 2008 - 05:21 PM
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/22/08 02:25AM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month