From: shreeve@...2s.org (Steve Shreeve) Date: 2002-02-27T17:05:57+09:00 Subject: Re: Question with for loop In article <656D49224B97EE3D.BD92C41451D8B9E5.28A1A2BE9B975276@lp.airnews.net>, Ron Jeffries wrote: Wow! Thank you all for such impressive responses to my question. The Ruby community lives up to it's impressive reputation again! I will rework my code to match the suggestions provided in this thread. Thanks again! Steve Shreeve Aliso Viejo, CA http://s2s.org >commands = <ORWU TOOLMENU,nil >ORWU HASKEY,XUPROGMODE >ORQQPX NEW REMINDERS ACTIVE >ORWORDG IEN,O RX,I RX,UD RX,IV RX >ORWU DT,NOW >ORWCH LOADAL >HERE > >def command(commands) > commands.each do | line | > items = line.chomp.split(',').reverse > command = items.pop > if items.size == 0 > puts "b.rpc('#{command}')" > else > while (arg = items.pop) != nil > puts "b.rpc('#{command}', ['#{arg}'])" > end > end > end >end