problem5

package
v0.0.0-...-cb75c49 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 27, 2025 License: MIT Imports: 0 Imported by: 0

README

Problem 5

Create a method in the Person struct which returns how another person's age compares. Format is {other person name} is {older than / younger than / the same age as} me.

p1 := &Person{"Samuel", 24}
p2 := &Person{"Joel", 36}
p3 := &Person{"Lily", 24}

p1.compareAge(p2) // "Joel is older than me."
p2.compareAge(p1) // "Samuel is younger than me."
p1.compareAge(p3) // "Lily is the same age as me."

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Person

type Person struct{}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL