From: Dean Strelau Date: 2006-06-29T02:52:45+09:00 Subject: Re: Beginners question: branching and ends ------=_Part_75736_27470512.1151517157317 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline I've found that GMail often mucks up code for whatever reason. You should check out nopaste[1] or pastebin[2]. [1]: [2]: || Dean On 6/28/06, Dark Ambient wrote: > > Helps a great deal! TY. I do use indentation and the odd thing is when > I cut/paste into the email , the indentation remains intact. I'm not > sure what gmail is doing (if anything) once it gets sent. > > Stuart > > On 6/28/06, Louis J Scoras wrote: > > Stuart; > > > > I've taken the liberty of reformating your code here. It is really > > important you you indent things correctly so that you can see the > > structure of the code clearly. You'll see that I've added lines to in > > the columns showing each construct and it's matching end tag: > > > > somearray.each do |x| > > | anotherarray.each do |y| > > | | if x == y > > | | | # ......do something....... > > | | else > > | | | # .....do something.......... > > | | end > > | end > > end > > > > See? As you suspected, the first end is paired up with the if/else > > construct. As indented above; however, you can plainly see how the > > end keywords match up with their controlling constructs. It turns out > > that you had the meaning of the last two ends switched in your > > comments. > > > > Everything needs to be properly nested. That is, you need to end the > > first do block before you can end the enclosed one. > > > > I hope that helps a little. > > > > > > -- > > Lou. > > > > > > ------=_Part_75736_27470512.1151517157317--