I have an array set up that I want to match the user input to a property
of a sting. However whenever I try to impliment the code the stings
never match and I am returned nil.
The first two ways I tried:
class POlist
def find(lookup)
@purchase_orders.find { |aPOlist| lookup == aPOlist.po_number }
# for i in 0... / purchase_orders.length
# return @purchase_orders[i] if lookup ==
@purchase_orders[i].po_number
# end
# return nil
end
end
and the other one:
found_one = false
print "Please Enter a PO: "
find_po = gets
for i in 0..aPOlist.length
if aPOlist[i] == nil then break
end
if find_po.to_s == aPOlist[i].po_number
found_one = true
puts aPOlist[i]
end
end
if found_one == false
puts "PO NOT FOUND"
menu_screen.root
end
--
Posted via http://www.ruby-forum.com/.