Bill Allombert on Wed, 25 Apr 2012 18:26:38 +0200 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
multi if GP language extension |
Dear PARI developpers, I have added a branch bill-multi_if which implement the multi-if extension. if(a,b,c,d) is an alias for if(a,b,if(c,d)), if(a,b,c,d,e) is an alias for if(a,b,if(c,d,e)), if(a,b,c,d,e,f) is an alias for if(a,b,if(c,d,if(e,f)), if(a,b,c,d,e,f,g) is an alias for if(a,b,if(c,d,if(e,f,g)), etc... This allow to replace if(a, b, /*else*/ if (c, d, /*else*/ if (d, e, f))) by if(a, b, /*else if*/, c, d /*else if*/, e, f) This can also be used a case statement of sort: if(x==0,"0", x==1,"1", x==2,"2", "default") Please experiment with it. Cheers, Bill.