Kata of the Day #10

Grasshopper - Personalized Message

kata
kata
kata
kata
kata
kata
kata
kata
kata
kata
kata
kata
kata
kata
kata
kata
kata
kata
kata
kata
Kata of the Day #10

Create a function that gives a personalized greeting. This function takes two parameters: name and owner.

Use conditionals to return the proper message:

  • name equals owner: 'Hello boss'
  • otherwise: 'Hello guest'

TypeScript


function greet(name: string, owner: string): string {
    return name === owner ? "Hello boss" : "Hello guest"
}

Go


func greet(name string, owner string) string {
    if name == owner {
        return "Hello boss"
    }
    return "Hello guest"
}

Python


def greet(name, owner):
    return "Hello boss" if name == owner else "Hello guest"

PHP


function greet($name, $owner) {
    return $name === $owner ? "Hello boss" : "Hello guest";
}

Go to Kata
ByJulie Kohl

Need some help?

Want us to give you some help with your business? No problem, here's a video on who we can help, and how, along with our calendar so you can book in a call to discuss us working together.

Let's see
budget
budget
budget
budget
budget
budget
budget
budget
budget
budget

Subscribe to our newsletter

subscribe
subscribe
subscribe
subscribe
subscribe
subscribe
subscribe
subscribe
subscribe
subscribe