Error “this method must return a result of type int”?

后端 未结 6 2060
攒了一身酷
攒了一身酷 2021-01-28 03:06

I have this code below and it keep telling me that thanksgiving() must return a result type of int. I have casted all the results just to make sure, but nothing seems to be work

6条回答
  •  粉色の甜心
    2021-01-28 03:19

    All the returns are in if statements, in this case, compiler sees that there might be a situation in which the function won't return anything. You need to add one return outside any ifs or in an else statement.

提交回复
热议问题