Error type help

Exercise : https://www.codecademy.com/courses/learn-c-plus-plus/lessons/cpp-functions/exercises/return-types-cpp-functions

Hello,
See the example with blue ?
Capture
I wanted, for revision, to guess what type of error it was (compile-time error, run-time error…) and I really can’t distinguish them. I could tell you the difference between types if you asked me to but I won’t recognize one if not from the ezample list given. To me they all seem logical ; it could be compile-time because the syntax is incorrect (the return has to be at the end), run-time error (cause you’re asking the computer to do something after the return which is impossible) and a logic error because this function is illogically written.

Thanks.

why would there be an error?
that’s a valid function.

it didn’t work though. The return isn’t at the end

there’s no such requirement

they said in the lesson the return had to be at the end and even showed that as an error example

If you intend for the code following return to be executed, then it would be considered a logical error. It will both compile and run as is.

1 Like