Skip to content

if2 is a weird/incomplete exercise #10

Description

@jaques-sam

The assignment is:

std::string fizz_if_foo(std::string fizzish) {
    if (fizzish == "fizz") {
        return "foo";
    }
    // Fix: Make new "else if" and "else" cases to pass the test
    
}

There is only 1 branch left, so you can simply fix it by adding return "foo"; as there is no other test validating a 3rd branch. Furthermore, next statements after early returns don't need else if. This would be against C++ Core Guidelines.
A solution is to add more checks at the end so an if statement is needed. And it won't solve the need for else if in the exercise.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions