You can easily increment or add one to a variable with the ++ operator. i++;
is the equivalent of i = i + 1; Note
The entire line becomes i++; , eliminating the need for the equal sign.
if you’d like to see the variable re-assigned you could use myVar= myVar +1
there is a better way though myVar += 1
but yet it’s not the best-looking way.
Hint: When writing a for loop we use i++ value of the i-variable is augmented by a unit.
It is great that you solved the challenge, but instead of posting your solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.
We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting solutions.