Troubleshooting a Boolean Expression Incrementing By 10

  • Thread starter Thread starter Mindscrape
  • Start date Start date
AI Thread Summary
The discussion revolves around troubleshooting a Boolean expression intended to output a value every ten years in a loop. The user is incrementing the year by 1 and using a conditional statement to check if the year is a multiple of ten. Initially, they faced compilation issues due to a typo in the code. The problem was resolved by correcting the syntax error, specifically by adding a second equals sign in the condition. This highlights the importance of careful syntax in programming to avoid compilation errors.
Mindscrape
Messages
1,854
Reaction score
1
I am trying to make a table that will output a value every ten years. Basically, I am incrementing the year by 1 in a while loop, and I want it so every time year=10, 20, 30... that it will output a value. I have:

if (year%10 == 0) {
... code
}

For some reason the compiler has trouble compiling this.

*Nevermind, I had a typo and forgot the second =.
 
Last edited:
Physics news on Phys.org
Glad you figured it out.
 
Back
Top