From: Scott Andrechek Date: 2009-08-24T17:57:18+09:00 Subject: Array Troubles I've made this small table making program (not reall trademarked) and have been trying to add the ability to make your own title. Every time it goes to make the table i get this message: tablemaker.rb:38: undefined method `rjust' for nil:NilClass (NoMethodError). Here is the code: thisisthewordpage=['page'] thisisthetitle=[] tableZZZ=0 tableZZ=0 tableZ=0 pagesZ=0 pagesZZ=0 play=true puts 'Please type your title for your table (if you type nothing the title will be Table of Contents)' toptitle=gets.chomp if toptitle=='' toptitle='Table of Contents' thisisthetitle.push toptitle if toptitle !='' thisisthetitle.push toptitle end end puts 'Please type your titles in first' table= [] while (title=gets.chomp)!= '' table.push title tableZ+=1 end puts 'Please type your page numbers' pages= [] puts table[tableZZZ] while (page=gets.chomp)!= '' tableZZZ+=1 puts table[tableZZZ] pages.push page pagesZ+=1 end linewidth0=55 linewidth1=45 linewidth2=60 linewidth3=10 linewidth4=5 puts (thisisthetitle[0].rjust(linewidth1)) # This is line 38 while play==true if tableZ!=0 puts (table[tableZZ].ljust(linewidth2))+ (thisisthewordpage[0].rjust(linewidth3)) + '' + (pages[pagesZZ].rjust(linewidth4)) tableZ+=-1 tableZZ+=1 pagesZ+=-1 pagesZZ+=1 if tableZ==0 play=false end end end if play==false puts '' puts 'Table Created by Table MakerTM' end Any help as always is greatly appreciated. -Scott Andrechek -- Posted via http://www.ruby-forum.com/.