126k views
5 votes
If you wanted to continuously add 5 to a count, how would you code it? Why do you prefer this method?

(from code.org)

1 Answer

3 votes
The word is increment. If you wan to keep adding adding 5 to a count you are incrementing the count. There are a few ways to do it and it also depends on the language that is being used.

PHP
$count = $count + 5;
$count++

C / C++
int count = 0;
count++;

Python
count += 5
User Yachoor
by
8.3k points