Signup/Sign In
Ask Question
Not satisfied by the Answer? Still looking for a better solution?

Even though i added return statement

package main
import "fmt"

func areaOfRect(length float64, breadth float64 ) float64 {
return (length*breadth)

}

func main() {
area := areaOfRect(7,9)
fmt.Println("Area of Rectangle is: ", area)
}
It is throwing below error
Have you added the return statement in the function areaOfRect?
I am unable to proceed further beacause of this error
by

2 Answers

sam5epi0l
package main
import "fmt"
func areaOfRect(length float64, breadth float64) float64 {
// write code here
return length*breadth
}
func main() {
area := areaOfRect(7,9)
fmt.Println("Area of Rectangle is:", area)
}
iamabhishek
Please try now, it should work.

Login / Signup to Answer the Question.