Here, can I edit return false because it seems to be in the wrong place for me (to return false at any time and/or case it was called in), or I should edit only the TODO
code section?
1 Answer
You can edit whatever you need to in order to make the logic work so that the program produces the expected results. If in the end, the code you write produces the same logical output, it should be fine. Just take note of any place where you change this code, because it might be hard to debug if CS50 rejects the logic.
That being said, I did not change the provided code, as it is generally expected (in my jobs/projects and labs outside of CS50) that one only works on the code segments that they were assigned and not adjust any of the already existing code around that.
-
Actually, I wonder why
return false
is written in the function, Jul 1, 2021 at 0:23 -
I don't think that the implementation will need the function to return
false
every time it 's called Jul 1, 2021 at 0:24 -
And I tried to put
return false
inside of a condition, and compilation error persisted. Jul 1, 2021 at 0:28 -
-
Glad I could help. You might have had compilation errors because a default
return
statement will be wanted by the compiler (so, if nothing is possible, return this). Jul 1, 2021 at 0:52