14 lines
214 B
Go
14 lines
214 B
Go
package rectangle
|
|
|
|
type Rect struct {
|
|
A,B int
|
|
color string
|
|
}
|
|
|
|
func New(newA int, newB int, newColor string) *Rect {
|
|
return &Rect{newA,newB,newColor}
|
|
}
|
|
|
|
func (r *Rect) Perimeter() int {
|
|
return 2 * (r.A + r.B)
|
|
} |