From: Chris Shea Date: 2007-01-23T13:40:08+09:00 Subject: Re: If-Then and "End" 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? > > -- > Posted via http://www.ruby-forum.com/. if uinput = "EXIT" then exit end That should work. Each 'end' is matched with the closest previous unmatched block opener ('if' in this case). It doesn't have anything to do with terminating a script. hth