F
fabsy
Im a newbie to ruby (hehe).
I have a question.
Is there any better way to do this? :
---------------
puts "Enter Username"
usr = gets
puts "Enter Password"
usr_pass = gets
User = "user"
Pass = "pass"
if usr > User
if usr_pass > Pass
puts "Correct user and pass"
else
puts "Correct user"
puts "Wrong pass"
end
else
if usr_pass > Pass
puts "Correct pass"
else
puts "Wrong pass"
end
puts "Wrong user"
end
------------------------This is the same but in VB---------
if usr = User and usr_pass = Pass then
print "correct user and password"
else
if usr = User and usr_pass <> Pass then
print "correct user and wrong password"
else
if usr <> User and usr_pass = Pass then
print "correct password and wrong user"
else
if usr <> User and usr_pass <> Pass then
print "wrong password and wrong user"
end if
end if
end if
end if
-----------------------------------------------------
-------And how do i do this in ruby? ------
If usr = User and usr_pass = Pass then
print "Correct User and Pass"
else
print "Wrong User or Pass"
endif
I have a question.
Is there any better way to do this? :
---------------
puts "Enter Username"
usr = gets
puts "Enter Password"
usr_pass = gets
User = "user"
Pass = "pass"
if usr > User
if usr_pass > Pass
puts "Correct user and pass"
else
puts "Correct user"
puts "Wrong pass"
end
else
if usr_pass > Pass
puts "Correct pass"
else
puts "Wrong pass"
end
puts "Wrong user"
end
------------------------This is the same but in VB---------
if usr = User and usr_pass = Pass then
print "correct user and password"
else
if usr = User and usr_pass <> Pass then
print "correct user and wrong password"
else
if usr <> User and usr_pass = Pass then
print "correct password and wrong user"
else
if usr <> User and usr_pass <> Pass then
print "wrong password and wrong user"
end if
end if
end if
end if
-----------------------------------------------------
-------And how do i do this in ruby? ------
If usr = User and usr_pass = Pass then
print "Correct User and Pass"
else
print "Wrong User or Pass"
endif