Talk:Middle three digits: Difference between revisions

Line 7:
 
::Ah. I get it now. The middle three digits are calculated numerically and then changed to an array of three characters for the non-error return value. Error conditions return a string type. Thanks. --[[User:Paddy3118|Paddy3118]] 22:13, 3 February 2013 (UTC)
::: Of course, you can also just check the length of the returned value, but that would be cowboy programming! :-) Discriminating between a string and a char[] is also not very solid, when safety is concerned. They are both string types. A function could easily return an error message as a char[]. It would be better to throw an error, or if you want to avoid the overhead, to return an Exception object. Then you can be certain.
Anonymous user