From: Lloyd Zusman Date: 2007-01-23T18:47:21+09:00 Subject: Re: If-Then and "End" gwtmp01@mac.com writes: > On Jan 22, 2007, at 11:32 PM, Sam C. wrote: > >> [ ... ] >> >> The problem is that the ruby compiler thinks that the first "end" is >> the end to the If-Then statement, instead of the "end" that ends the >> program. How do I work around this? > > I think you are looking for 'exit' as the method to call to terminate > a program. Also you aren't doing a comparison in your if condition, > you are doing an assignment. So you want something like: > > if uinput == "EXIT" then > exit > else > # do something else > end Just a small point: you don't need an 'else' clause after an 'exit', since nothing could follow that statement. Hence, you can just do this if you want, and it will have the same effect: if uinput == "EXIT" then exit end # do something else I tend to do that with 'exit', 'return', 'raise', 'throw', 'next', 'redo', and 'break' statements, to avoid excessive nesting. But that's just a stylistic thing. -- Lloyd Zusman ljz@asfast.com God bless you.