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 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.)

src/code.my.com/git/sales/tax.go
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.