954,551 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Accumulators and counters

When I look at a statement, how can i tell whether it's an accumulator or a counter?

NAGASAKI
Newbie Poster
2 posts since May 2007
Reputation Points: 10
Solved Threads: 0
 

Please give an example. An accumulator will generally add several numbers to it. A counter adds one.

waynespangler
Posting Pro in Training
461 posts since Dec 2002
Reputation Points: 84
Solved Threads: 58
 

Thank you! You've answered my question. I thought a counter could add more than one.

NAGASAKI
Newbie Poster
2 posts since May 2007
Reputation Points: 10
Solved Threads: 0
 

The qualifier is "generally". No hard and fast rule.

waynespangler
Posting Pro in Training
461 posts since Dec 2002
Reputation Points: 84
Solved Threads: 58
 

'Loop allows for a repitition of statements - using a condition to decide when the loop should continue or stop
'There are 2 main concepts that come into loops;
'1 - Incrementing - counter = counter + 1 -- always by a constant (in this case '1')
'2 - Accumulating - totalsales = totalsales + sales -- always by a variable (in this case 'sales')

J-eezy
Newbie Poster
1 post since Feb 2010
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You