Skip to content

Instantly share code, notes, and snippets.

@reetasingh
Created January 22, 2023 20:49
Show Gist options
  • Select an option

  • Save reetasingh/19f51d0a9b6f3a3e3e49e770f5959467 to your computer and use it in GitHub Desktop.

Select an option

Save reetasingh/19f51d0a9b6f3a3e3e49e770f5959467 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"math"
)
type Circle struct {
r float64
}
func (c *Circle) area() float64 {
if c == nil {
return 0
}
return math.Pi * c.r * c.r
}
func main() {
var c *Circle
fmt.Printf("(%v, %T)\n", c, c)
fmt.Println(c.area())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment