"Try it now"

spir denis.spir at gmail.com
Thu Apr 14 05:25:03 PDT 2011


On 04/14/2011 03:04 AM, Adam D. Ruppe wrote:
> bearophile wrote:
>> >  This is a problem. Unittest code is not meant to produce an output,
>> >  while online snippets to try are meant to nearly always produce a
>> >  meaningful output.
> I don't know - I like the approach Andrei took in the docs, writing
> a series of true assertations.
>
> assert(sort([4, 2]) == [2, 4]);
>
> does look pretty neat. I guess the alternative is:
>
> writeln(sort[4, 2]); // prints "[2, 4]"

What about

    // sort([4, 2]) == [2, 4])

? Looks to me both simpler & clearer.

Denis
-- 
_________________
vita es estrany
spir.wikidot.com



More information about the Digitalmars-d mailing list