Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Go Go Language Overview Go Syntax Functions

i need help with this. Doesnt seem hard, but its bit complicated for me. Im very new to programming.

parameter representing a sales total, and a second float64 parameter representing a tax rate. The function should multiply the sales total by the tax rate, and return the result as a float64 value. So, for example, sales.CalculateTax(100.0, 0.08) should return approximately 8.0. (Very small floating-point math errors are OK.)

package sales
var salesTotal := float64
var tax rate := float64
Sales.CalculateTax := Sales total * tax rate
func Sales.CalculateTac(100.0, 0.08) (float64 float64) return float64 {


1 Answer

Raffael Dettling
Raffael Dettling
32,998 Points

You declared the function wrong it takes to parameters with type float64 and the return statment should always be inside the curlybraces the float64 after the parameters shows which type the function returns :) If you´re new i dont recomend to start with go it´s a small lesson and not as easy to learn for beginners.

package sales

func CalculateTax(salestotal float64 ,taxrate float64)float64 {
  return salestotal*taxrate 

Try out the C# or the Java tracks to get a basic knowlege about programming and syntax. Or start with html, css, javascript it depends on what your goal is.

I'm actually learning go because i want to become a blockchain developer working with cryptocurrency.