<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>On Jun 6, 2015, at 20:03, Cory Beutler <<a href="mailto:cgbeutler@gmail.com">cgbeutler@gmail.com</a>> wrote:</div><div><br></div><blockquote type="cite"><div><div dir="ltr"><font face="monospace, monospace">I recently(1 year ago) realized that 'if', 'elif', and 'else' provide easy branching for code, but there is no easy way to merge branches of code back together. One fix for this would be introduction of two new keywords: 'also' and 'alif' (also if)<br></font></div></div></blockquote><div><br></div><div>Can you provide a realistic use case for when you'd want this, instead of just a toy example where you check meaningless variables for equality?</div><div><br></div><div>Because in practice, almost every time I've wanted complicated elif chains, deeply nested ifs, or anything else like it, it's been easy to either refactor the code into a function, replace the conditionals with a dict, or both. That isn't _always_ true, but I'm having a hard time coming up with an example where I really do need complicated elif chains and your new syntax would help.</div><br><blockquote type="cite"><div dir="ltr"><div><font face="monospace, monospace">on True:</font></div><div><font face="monospace, monospace">    1. Execute code block</font></div><div><font face="monospace, monospace">    2. Jump to next 'alif', 'also', or end of if-chain</font></div><div><font face="monospace, monospace">on False:</font></div><div><font face="monospace, monospace">    1. jump to next 'elif', 'else', or end of if-chain</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">Note: 'also' blocks can be useful in more places than just the end of a chain:</font></div><div><font face="monospace, monospace">if a == b:</font></div><div><font face="monospace, monospace">    print ('a == b')</font></div><div><font face="monospace, monospace">elif a == c:</font></div><div><font face="monospace, monospace">    print ('a == c')</font></div><div><font face="monospace, monospace">also:</font></div><div><font face="monospace, monospace">    print ('a == b == c')</font></div><div><font face="monospace, monospace">else:</font></div><div><font face="monospace, monospace">    print ('a != b and a != c')</font></div></div></blockquote><div><br></div><div>This example seems to do the wrong thing. If a=b=2 and c=3, or a=c=3 and b=2, you're going to print "a == b == c" even though that isn't true. </div><br><div>This implies that maybe it isn't as easy to think through the logic and keep the conditions in your head as you expected, even in relatively simple cases.</div></body></html>