You are Here: Home

# Can you explain what "for a = 8 to 19 step 4" as pseudocode means in english? Watch

Announcements
1. First two lines of a given pseudocode are:

for a = 8 to 19 step 4
for b = 1 to 3
Im guessing that this means that "a" is in the range of 8 to 19, and "b" is in the range of 1-3, is this correct?If so, what does the "for" mean at the start if both lines? And what does "step 4 mean"?Thanks!
2. "for" indicates that the code should loop, so the code on the next line should run once for each value. eg
Code:
```for b = 1 to 3
print b```
would print 1, 2, and 3.

"step 4" just means step on by 4 rather than 1, so
Code:
```for a = 8 to 19 step 4
print a```
would print 8, 12, 16.
3. (Original post by schoolcoders)
"for" indicates that the code should loop, so the code on the next line should run once for each value. eg
Code:
```for b = 1 to 3
print b```
would print 1, 2, and 3.

"step 4" just means step on by 4 rather than 1, so
Code:
```for a = 8 to 19 step 4
print a```
would print 8, 12, 16.
Thanks. What do you mean by "the code on the next line should run once for each value"? Do you mean that the "for" means that if a code said "for a = 1 to 5", then the for loop would mean that if the next line was "print a", it would print 1, 2, 3, 4, 5, because it would print each value of "a" one time each?
4. (Original post by blobbybill)
Do you mean that the "for" means that if a code said "for a = 1 to 5", then the for loop would mean that if the next line was "print a", it would print 1, 2, 3, 4, 5, because it would print each value of "a" one time each?
Yes, that's exactly how it works.

TSR Support Team

We have a brilliant team of more than 60 Support Team members looking after discussions on The Student Room, helping to make it a fun, safe and useful place to hang out.

This forum is supported by:
Updated: September 25, 2016
Today on TSR

### What if I get all As and one U?

Discussions on TSR

• Latest
• ## See more of what you like on The Student Room

You can personalise what you see on TSR. Tell us a little about yourself to get started.

• Poll
Useful resources

Can you help? Study Help unanswered threadsStudy Help rules and posting guidelines

## Groups associated with this forum:

View associated groups
Discussions on TSR

• Latest
• ## See more of what you like on The Student Room

You can personalise what you see on TSR. Tell us a little about yourself to get started.

• The Student Room, Get Revising and Marked by Teachers are trading names of The Student Room Group Ltd.

Register Number: 04666380 (England and Wales), VAT No. 806 8067 22 Registered Office: International House, Queens Road, Brighton, BN1 3XE

Reputation gems: You get these gems as you gain rep from other members for making good contributions and giving helpful advice.