From: Robert Klemme Date: 2007-01-23T17:00:13+09:00 Subject: Re: If-Then and "End" On 23.01.2007 05:45, gwtmp01@mac.com wrote: > > On Jan 22, 2007, at 11:32 PM, Sam C. wrote: > >> I am making a program with various commands. One of them is "Exit" which >> is supposed to exit the program. Here is my code: >> >> if uinput = "EXIT" then >> end >> end >> >> 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 Alternatively exit if uinput == "EXIT" ... robert