Reputation: 375
I just started learning ruby language and I am doing exercises from Codeeval.com. Just started from the first exercise Fizz Buzz. I have a folder with .txt file which contains the input and logic.rb file with my code for this exercise.
I want to check my code using command-prompt and I don't know what should I write there to run my code and to see the output. I have tried to run: C:\folder> ruby logic.rb
, but it does not work... Could any one help? Thanks!
Upvotes: 0
Views: 715
Reputation: 825
you should be able to run from command line in any folder "ruby -h" and see the help parameters for Ruby. If this is not the case then you would have to either add ruby's executable directories to your windows search path or drill down to the ruby install directory. "cd c:\program files\ruby\etc"
An easy way to see if ruby is in your windows search path is to run the "set" command in your cmd prompt and look for the values defined in the "Path=" variable.
To add locations to the windows search path you can navigate to the environment variables.
Right Click Computer Icon -> Properties -> Advanced System Settings -> Advanced Tab -> Environment Variables
In some cases a reboot of that machine will be required for windows to allow execution to those newly added locations.
I am not a Ruby programmer but in general execution I think its the direction needed.
I also see that command in Ruby of "PUTS" writes output to console similar to an "Echo" or "Write-Host" in other languages.
something like...
puts "hello"
Upvotes: 1