integer max, min?

Paolo Invernizzi arathorn at NO_SPAMfastwebnet.it
Tue Oct 2 11:12:19 PDT 2007


Thanks Steven,
I know the ternary operator, and that's good for simple variable 
comparison, but if you use it in complex expressions, say also more than 
one times, sometimes it's not so readable as plain old min/max.

Paolo.

Steven Schveighoffer wrote:
> "Paolo Invernizzi" <arathorn at NO_SPAMfastwebnet.it> wrote in message 
> news:fdt65v$1306$1 at digitalmars.com...
>> Silly question...
>>
>> Where are in Phobos the max and min for integers?
>>
>> Thanks, Paolo
> 
> try x < y ? x : y for min(x, y)
> and x > y ? x : y for max(x, y)
> 
> -Steve 
> 
> 


More information about the Digitalmars-d-learn mailing list