a ‘return’ expression required in a function with a block body (‘{…}’) - I have a return expression in my function however it is within an if conditional code statement with ‘{…}’ . Is this why my function isn’t working and if not what is likely to be the problem?
Please provide the code of your function. Generally speaking, if a function is declared to return some value then you must guarantee that it always returns something. For example, you can’t place return
only in some if
, because then what should be returned if condition is not met?
I’ve fixed it, my else statement was print(“Error”) rather than return (“Error”). Beginner’s error
Thank you.