Need help with bugfixing

I’m new and keep getting the errors password.
rb:41: syntax error, unexpected keyword_else, expecting keyword_end
password.rb:47: syntax error, unexpected $end, expecting keyword_end
how can I fix it?

$namelist = [0,100]
$count =
$passlist = [0,100]
$namecount = 0
$passcount = 0

def newaccount
$namelist[$count] = gets.chomp
puts “Type a username:”
$passlist[$count] = gets.chomp
puts “Type a password:”
sleep (2)
puts “account created.”
end

def savedaccount
user == gets.chomp
puts “Type in your username:”
pass == gets.chomp
puts “Type in your password:”
loop do
if $namelist[$namecount.to_i] != user
until $namelist[$namecount.to_i] == user
user == $namecount.to_s
end
loop do
if $passlist[$passcount.to_i] != user
until $passlist[$passcount.to_i] == user
user == $passcount.to_s
end
end
if $passcount == $namecount
puts “welcome #{namecount}”
end

puts “type new to make a new account or saved to access an existing
account”.
input == gets.chomp
if input == “new”
newaccount
end
else
if input == “saved”
savedaccount
end
end
end
end

Thanks!

Am 25.05.2013 15:21, schrieb Aneurin Evans:

I’m new and keep getting the errors password.
rb:41: syntax error, unexpected keyword_else, expecting keyword_end
password.rb:47: syntax error, unexpected $end, expecting keyword_end
how can I fix it?

The error message means that the interpreter encounters an else' keyword where there shouldn't be one, and it encounters the end of the file ($end) while one or moreend’ keywords are still missing.

The correct syntax of the if-else construct is

if …
# do something
else
# do something
end

Also

if …
until …
# do something

doesn’t make any sense, use

if …
# do something
end

OR

until …
# do something
end

Furthermore:
==' tests for equality, you need to use=’ for assignments