R
Ryan Edwards-crewe
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 if lookup ==
@purchase_orders.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 == nil then break
end
if find_po.to_s == aPOlist.po_number
found_one = true
puts aPOlist
end
end
if found_one == false
puts "PO NOT FOUND"
menu_screen.root
end
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 if lookup ==
@purchase_orders.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 == nil then break
end
if find_po.to_s == aPOlist.po_number
found_one = true
puts aPOlist
end
end
if found_one == false
puts "PO NOT FOUND"
menu_screen.root
end