Hi @daz3d,
Great stuff
I think it just depends on whether you need to use the return value or not, or leave yourself the option to use it in future development (although it would be just as easy, and probably more straightforward to add it in later if you need it). I think itâs probably a personal thing too. Personally, I donât like to leave any loose ends, and I also think itâs clearer to another developer reading my code if the return statement isnât there when Iâm not using a return value from that function.
Some functions which generate side effects simply donât return any value (I think )⌠and having had another quick look at your
doIt()
function, I suspect that this may be the case here. If the function doesnât return any value, then I think itâs pointless to include the return statement, although Iâm definitely prepared to hear other points of view on this
Iâve tested this, and your latest version seems to work for me with all scenarios: all negative numbers, mix of negative and positive, reverse ranges etc etcâŚ
Anyway, the point Iâd make here is that itâs always good to test as many different scenarios as possible to avoid problems and bugs later onâŚand then also remain open to others being found which you may need to update and adapt your program for.