There general strategy is to use more functions or have a flat case on a tuple of comparisons (if that can be done sensibly). You could also use exceptions for flow control, but then you have two problems :)<span></span><div>
<br>On Monday, March 25, 2013, 饕餮 <<a href="mailto:249505968@qq.com">249505968@qq.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>When in other language.We can use like:</div>
<div>example(Something){</div><div> if( Something == false)</div><div> return;</div><div> //do something here;</div><div>}</div><div>But in Erlang.I have to write like:</div><div><div style="line-height:16.799999237060547px">
<div style="line-height:16.799999237060547px">example(Something) -></div><div style="line-height:16.799999237060547px"> if</div><div style="line-height:16.799999237060547px"> Something == false -></div><div style="line-height:16.799999237060547px">
false;</div><div style="line-height:16.799999237060547px"> true -></div><div style="line-height:16.799999237060547px"> %do something here</div><div style="line-height:16.799999237060547px">
end.</div></div></div><div style="line-height:16.799999237060547px"><br></div><div style="line-height:16.799999237060547px">That's could make the multiple nested like:</div><div style="line-height:16.799999237060547px">
<div style="line-height:16.799999237060547px">example(Something) -></div><div style="line-height:16.799999237060547px"> if</div><div style="line-height:16.799999237060547px"> Something == false -></div><div style="line-height:16.799999237060547px">
false;</div><div style="line-height:16.799999237060547px"> true -></div><div style="line-height:16.799999237060547px"> if</div><div style="line-height:16.799999237060547px"> Otherthing == false -></div>
<div style="line-height:16.799999237060547px"> false</div><div style="line-height:16.799999237060547px"> true -></div><div style="line-height:16.799999237060547px"> %do something here</div>
<div style="line-height:16.799999237060547px"> end.</div><div style="line-height:16.799999237060547px"><br></div><div style="line-height:16.799999237060547px">Some code could make 5 or more nested in it.</div><div style="line-height:16.799999237060547px">
Is there any idea to make short circuit to reduce of the nested?</div></div></blockquote></div>