unexpected tidentifier expecting keyword_end [closed] - ruby

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 6 years ago.
Improve this question
I've got a problem in Ruby, "unexpected tidentifier expecting keyword_end", how Can I solve it?
def riko(user)
if user.name.eql? 'Mia Khalifa Fan'
#client.send_msg 'Hola Mia <3 ¿Cómo te trato este dia, cosa guapa y sensual?',
else
if user.mame.eql? 'Skul Goy'
#client.send_msg 'Muerete. '
else
#client.send_msg "Hola #{user.name} o/ \ :v / "
end
end

You're using else if which works fine in other languages, but in Ruby represents 2 distinct conditionals. You probably want to replace it with elsif instead, which is the Ruby equivalent.

Related

vbscript minus operator marked as invalid character [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 3 years ago.
Improve this question
I have a very simple equation in vbscript/asp. I get error on minus operator. I even had to add 0 in start of equation because I got same error at first one too.
y = 0 - (0.0114 * (x^2)) − (0.2396 * x) + 112.57
Microsoft VBScript compilation error '800a0408'
Invalid character
y = 0-(0.0114 * (x^2))-(0.2396 * x)+112.57
----------------------------^
The character between the x^2)) and the (0.2396 does not look like the character between the 0 and the (0.0114. It is likely an en dash, not a minus/hyphen. Fix that. Do not use Word or other word processor for creating code; the smart replacement of dashes and quotes will cause problems with code. Use a text editor like Notepad or Notepad++ instead.

What is the syntax error in this short ruby block? [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 5 years ago.
Improve this question
What is the syntax error in this short ruby block?
def do_this (a,b,c)
puts 1.to_s, 2.to_s,3.to_s
if a == 4
do_this (1,2,3)
end
end
do_this (4,5,6)
I get errors on the fourth and seventh lines, where "do_this" is called.
The error is: 'unexpected ")", expecting "." or...' [...]
Remove spaces between method name and parentheses.
You need to avoid using spaces between the method call and the arguments in parenthesis:
def do_this (a,b,c)
puts 1.to_s, 2.to_s,3.to_s
if a == 4
do_this(1,2,3)
end
end
do_this(4,5,6)

Array Not Defined in Loop? [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 7 years ago.
Improve this question
I have code like the following:
arra = ["a","b","c"]
arrb = ["a","e","d"]
arrc = arra - arrb
while arrc.size != 0
somedef(arrc)
end
I get this error:
NameError: undefined local variable or method `arrc' for main:Object
pointing to the line inside the while loop. Can anyone help me understand why this is?
Are you doing something like this in "somedef":
def somedef(a)
p arrc
end
If so, you get the error because "arrc" is not a global variable. Do this instead:
def somedef(a)
p a
end

syntax error, unexpected keyword_end, expecting end-of-input [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
I have this code:
Class Card
def initialize(suit, number)
#suit = suit
#number = number
end
end
I am getting the error message:
/go_fish/lib/Card.rb:8 syntax error, unexpected keyword_end, expecting end-of-input (SyntaxError)
Any suggestions or stuff I'm missing?
Your error is the first char in the first line. class should be lowercase...
class Card
def initialize(suit, number)
#suit = suit
#number = number
end
end
Furthermore you may want to follow common rules for coding styles in Ruby. To do so change the file name to card.rb (again lowercase), same with require. And it is common to indent with just two whitespace characters in Ruby files.

Ruby code not getting result [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
So heres what I'm using
puts "How old are you?"
age = gets
if age == 10
puts "Yo"
end
I expect to see Yo if I enter 10, but don't. I'm fairly new, any ideas?
Yes, change it to
age = gets.to_i
Kernel#gets gives a string, you need to convert it to integer to do the integer comparisons. Read String#to_i method too.
You are typing a string and expecting it to return an integer
Do this:
puts "How old are you?"
age = gets.chomp
if age == "10"
puts "Yo"
end

Resources