Hi all,
I am making a function which should return "true" if the input variable
"string" is a palindrome, and returns either "nil" or "false" otherwise.
Following is the regex i used:
def palindrome?(string)
*/\w#{string.reverse}$/i =~ /\w{string}$/i
* end
The above function, however returns error:
TypeError:
can't convert Regexp to String
# your_code.rb:2:in `=~'
# your_code.rb:2:in `palindrome?'
# spec.rb:7:in `block (2 levels) in <top (required)>'
# ./lib/rspec_runner.rb:36:in `block in run_rspec'
# ./lib/rspec_runner.rb:32:in `run_rspec'
# ./lib/rspec_runner.rb:23:in `run'
# lib/graders/weighted_rspec_grader.rb:6:in `grade!'
# ./grade:31:in `<main>'
Please help.
And my apologies to take your time with such petty problems
···
--
Regards
Karan