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 trialLouie Reyes
42,813 PointsHi, can I get some help on this question .. I'm stuck
Fix the error in the below code so that it will run and print the string "Hello, world!".
package sales
import ( “fmt” “ math”
var total = 1234.56
func main() {
report.go(total)
fmt.Println(report.go)
}
package sales
import (
“fmt”
“math”
var total = 1234.56
func main() {
report.go(total)
fmt.Println(report.go)
}
1 Answer
Steven Parker
231,236 PointsThe code shown above doesn't seem at all related to the challenge linked by the button and mentioned on the first line.
The issue in the "Hello, World!" challenge is that a variable is assigned but never used. But there's a perfect place to use it on the next line, and it saves repeating the same string again.
If you have an issue with the code shown above, it might be a good idea to create a new question for it.
Vladimir Vasconcelos
Courses Plus Student 6,433 PointsVladimir Vasconcelos
Courses Plus Student 6,433 PointsFirst looking your code I see a missing " ) " closing your imports.
When you use "var" you need to declare the type of the variable: Ex:
var score float = 1234.56
or you can declare and initialize using inference type: Ex:
score := 1234.56
Hope this could help.