Talk:Middle three digits: Difference between revisions

Line 4:
==Second D entry and return type==
Because the middle three digits can have leading zeroes, I would think that the more natural return type would be a string rather than an int. --[[User:Paddy3118|Paddy3118]] 19:18, 3 February 2013 (UTC)
: I didn't write that code, but I think I can explain it. The return type is a [http://dlang.org/phobos/std_variant.html#.Algebraic Variant] type that can represent ''any'' type. In this case it's limited to the types listed: string, char[]. So the function will return a Variant that represents either a string or a char[] (in the form of a Variant). By looking at the returned type (peek) you can tell whether or not an error occured. [[User:Fwend|Fwend]] 21:54, 3 February 2013 (UTC)
Anonymous user