Dual conditions in D and Python
weaselcat via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu May 21 16:19:37 PDT 2015
On Thursday, 21 May 2015 at 23:14:47 UTC, Dennis Ritchie wrote:
> On Thursday, 21 May 2015 at 21:35:22 UTC, Ali Çehreli wrote:
>> We're almost there. :)
>>
>> bool is_between(T0, T1, T2)(T0 what, T1 min, T2 max)
>> {
>> return (what >= min) && (what <= max);
>> }
>>
>> void main()
>> {
>> if (5.is_between(4, 6)) {
>> // ...
>> }
>> }
>>
>> Ali
>
> A condition is that if, for example, that? :)
>
> if (5 > 2 > -9 > -13 < 10 == 10 < 21 != 45):
> print("OK")
this looks like gibberish upon first sight and is not something
I'd want to see in code I inherit.
More information about the Digitalmars-d-learn
mailing list