-1

New to Ruby. I have created a very simple script called "hello.rb":

name = "Frederik"
puts = "Hello #{name}"

It will not execute (there is no output) in my terminal when I run "ruby hello.rb". I have checked that my editor (atom) is creating EOL's using "cat -e hello.rb" as suggested by "mu is too short" here: Why won't my Ruby script execute?. What could be causing this? I have attached a screenshot for reference.

Screenshot

Thank you!

1 Answer 1

1
puts = "Hello #{name}"

You're assigning "Hello #{name}" to a variable named puts, not writing it to STDIO.

remove the assignment operator and your output should display normally.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks mcfinnigan - appreciate it

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.