From: Dark Ambient Date: 2006-07-01T23:39:31+09:00 Subject: Re: Help please On 7/1/06, Matthew Smillie wrote: > On Jul 1, 2006, at 13:24, Dark Ambient wrote: > if > > elsif > > else > > end > > You can have as many elsif statements as you like (including zero), > and zero or one else statements, and the whole construct is finished > off with an 'end' So, all if / else must have a following end ? I realize it must be somewhere, but do they always necessarily follow the if / else or perhaps could they be further down depending on the code logic ? > > PS: Is your editor using tabs or spaces for indentation? I tried to > send myself code over gmail and it came through just fine unless I > had a mix of spaces and tabs as indentation, which turned it into > muck. If this is the case, there may be an option to indent using > spaces. Otherwise, you could probably enter the code manually using > spaces to preserve indentation. > I think guilty as charged. Using a combo of tabs and spaces in Scite. Here (and I dont' want to keep posting new designs) but here is something that looks logical to me: What is happening with this code is it keeps asking about the same file. I thought the 'each do' would continue to loop through. Doesn't seem to be the case. I tried adding something to the while like 'until pic_names.length' , didn't go over well. :) btw , i removed tabs and spaces from paste, and then spaced in Gmail. pic_names = Dir['C:/PicturesMoved/*.{BMP,bmp}'] pic_names.each do |name| #start of array loop continue = true # setting up the conditon to end the while loop while (continue) fcheck = FileTest.exist?(name) #should be confirming files exist in directory #probably this is out of context though I don't #believe it's doing any damage if fcheck == false puts 'file does not exist' else puts 'Do you wish to move ' + name + 'file?,"yes" or "no" ?' decision = gets.chomp.downcase end # for 1st if block perhaps wrong ? if decision == 'no' puts 'file will not be moved' pic_names.delete(name) end # for 2nd if block end # for array loop end # for while loop