You are here

A.3.3 I’ve got a function or method that doesn’t return what I expect.

4 September, 2015 - 10:52

If you have a return statement with a complex expression, you don’t have a chance to print the return value before returning. Again, you can use a temporary variable. For example, instead of:

return self.hands[i].removeMatches()

you could write:

count = self.hands[i].removeMatches()return count

Now you have the opportunity to display the value of count before returning.