Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Go Language Go Language Overview Flow Control Loops

Error in the question

The end number needs to be incremented by 1

src/loops/loop.go
package loops

import "fmt"

func CountByThrees(start int, end int) {
  // YOUR CODE HERE
}

1 Answer

Steven Parker
Steven Parker
231,275 Points

You probably don't want to increment the "end" number. You'll need it in your loop to know when to stop.

You will want to increment a loop variable, but perhaps not by 1 (hint: the name of the function is "CountByThrees").

There is an error in the question, your suggested solution wouldn't work and you will be stuck.

Steven Parker
Steven Parker
231,275 Points

It should work just fine if your loop begins at the start value, and runs while the loop variable is less than or equal ("<=") to the end value, and of course increments by 3.