Re: Can't get If statement right

2013-03-05 Thread Robert Klemme
On Mon, Mar 4, 2013 at 10:15 PM, Peter Hickman wrote: > Ruby supports the if, else statements so it is fine to use it. It is just a > personal preference of mine. There is nothing "better" about using the case > statement (well none that I am aware of). Maybe that "case" conveys the notion of sev

Re: If statement

2012-12-03 Thread Robert Klemme
On Mon, Dec 3, 2012 at 12:39 PM, Joel Pearson wrote: > If you do trust your user enough to let them execute system commands (I > assume this is your goal with the backticks), I think the way to input a > variable is this: > > system("#{op}") Superfluous - this is sufficient: system op If you do

Re: If statement

2012-12-03 Thread Robert Klemme
On Mon, Dec 3, 2012 at 12:35 PM, Masoud Ahmadi wrote: > This row solved my problem, > if op == "Q\n" > I was not aware of this little new line thing Just a note on that one: I think this solution is inferior to doing op.chomp! if op == "Q" or if op.chomp == "Q" Reason: on other platforms you