Code Monkey home page Code Monkey logo

Comments (3)

github-learning-lab avatar github-learning-lab commented on June 28, 2024

That's correct!

Running Our Program

Now that we have our "Hello World!" program written, it's time to test it out by running it. Let's head back into our command line and execute our code with the ruby command followed by the name of our file. We do this by entering the following into the command line:

ruby hello.rb

Our program should execute and we should see in our terminal the output "Hello World!".

Your command line should look like this:

user$ ruby hello.rb
Hello World!

๐ŸŽŠAwesome! You've written and ran a "Hello World!" program.

The ruby command launches what's called the Ruby interpreter and that interpreter reads the file hello.rb and evaluates what's inside. The interpreter read our line of code and called the puts method. Our string was then passed to the method and printed to the screen. You'll notice that the quotes were not printed to the screen, and that's because the quotes are not part of the string, rather, they act as bookends to the string.

Now that we've changed our code, we have a newer version than our repository. If you want to check on that, you can type the following code into your command line:

git status

You should see one file is modified. It's good practice to commit our changes early and often and back those changes up by pushing them to the remote repository.

We can do just that by following these three steps:

Stage the files that have been changed:

git add .

Commit the changes and enter a message describing the commit:

git commit -m "Hello World"

Push the changes to the repository:

git push

Push the changes to GitHub to continue

from ruby-course.

JSilvaLabs avatar JSilvaLabs commented on June 28, 2024

c

from ruby-course.

github-learning-lab avatar github-learning-lab commented on June 28, 2024

Great!

With our first program up and running and our project backed up remotely, it's time to step a bit further and add some interactive functionality.

I've opened a new issue for you with the next steps.

from ruby-course.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.