Comments (3)
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.
c
from ruby-course.
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)
- Set up your environment HOT 3
- Using Ruby Methods HOT 1
- Using If/Else Statements HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ruby-course.