From: Avatar - QUELLO VERO VERO - Date: 2008-02-01T00:29:56+09:00 Subject: Re: can ik make this more beautifull? Felipe Giotto ha scritto: > Actually, when you set x to nil, in the end of the code, you're losing > your entire second "if" clause. Unless these conditions are calls to > other functions or something like that, you could refactor your code > this way: > > x = condition1 ? 1 : nil > > Best regards! > > Felipe Giotto ;-) > > > On Jan 31, 2008 9:52 AM, Remco Hh wrote: >> nowadays i try to improve my coding style to produce nicer and beter >> readable code. I try to improve the following code but i dont know how. >> >> if condtion1 >> x=1 >> else >> if condition2 >> x=2 >> else >> if condition3 >> x=3 >> end >> end >> x=nill >> end >> >> there are three different conditions which can not occur at the same >> time >> can i make this nicer? just learn to quote... http://www.carnackyweb.com/?p=30