خرید بک لینک

Vote count: 0

@users = [
{id:"0", name:"Thomas One", email:"[email protected]", password:"adkdjaso"},
{id:"1", name:"James Five", email:"[email protected]", password:"jdajdlae"},
{id:"3", name:"Gordon Four", email:"[email protected]", password:"adsldsae"}
]

def getId
  puts "what is your email address?"
    @account = gets.chomp

  if @users.find |x| x[email:] == @account
    puts "Welcome #{@users[name:]}"
    break
  else 
    puts "your account does not exist try again!"
  end
end

how do i search through an array of hashes based of the users email and then print out his name ?

asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: جمعه 4 تير 1395 ساعت: 5:17

صفحه بندی