Git Product home page Git Product logo

hello-world-ruby's Introduction

Hello World

Learning Goals

  • Create a new Ruby file.
  • Write syntactically valid code to produce "Hello World!"
  • Run a Ruby file.

Introduction

We're going to make a file that will print "Hello World!" to your terminal.

Instructions

Begin by forking and cloning this repo to your local environment and open the directory in VS Code.

Creating a File

Start by creating a text file called hello_world.rb within the lab's directory. The .rb file extension is a common convention for specifying the language of the file — in this case, Ruby.

Writing Code

In the file hello_world.rb that you created, you need to write a single line of code that prints the string Hello World! to your terminal. To print in Ruby, you need to use the method puts which is short for "output string." And because Hello World! is a string, you need to surround your text with "".

File: hello_world.rb

puts "Hello World!"

Anytime you make changes to a file (like the one you've just made) you need to save the file, so your changes are preserved. If you forget to save the file before you run your tests, the last saved version of the file will be run — without your changes — and this can be very confusing! In this case, if you forget to save, what gets run might be just an empty document (which won't do anything very exciting). Always remember to save the file every time you make changes by selecting Save from the File menu.

Executing Your File

Execute this file by typing ruby hello_world.rb into your terminal and pressing enter. The ruby part of that command tells your computer to use the Ruby interpreter when reading and executing the code in your file. The second part of the command, hello_world.rb is the path to the file you want to run.

Reminder: be sure to save your file before trying to run it.

You should see:

$ ruby hello_world.rb
Hello World!

Running the Tests

Confirm everything is working by running the rspec command. You should see that all tests are passing (e.g. no red error text). Once you have the tests passing, submit your work using CodeGrade.

Hello World History

A small piece of coding history — a handwritten version of Hello World in C (an early programming language).

Hello World! Art

Hello World! by Brian Kernighan, from Artsy's Algorythm Auction. Based on a 1974 Bell Laboratories internal memorandum by Brian Kernighan, Programming in C: A Tutorial, which contains the first known version.

hello-world-ruby's People

Contributors

annjohn avatar aviflombaum avatar deniznida avatar dfenjves avatar fislabstest avatar fs-lms-test-bot avatar gj avatar kthffmn avatar lizbur10 avatar markedwardmurray avatar matbalez avatar maxwellbenton avatar mjcalavano1 avatar mjl-fs-test-107 avatar notnotdrew avatar sammarcus avatar sarogers avatar sirmatt avatar talum avatar telegraham avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hello-world-ruby's Issues

saving

i can not locate how to save or run the code that i wrote to the console

button open

Sorry i use Chrome, but the open button on toolbar don't show please; how to do in order to code?

Nitrous users generally struggle with this

Many Nitrous users seem to struggle on this lab. Maybe because they're unfamiliar with how to navigate around? They often are just in the wrong directory, etc.

It might be worth breaking out separate instructions or adding Nitrous hints throughout?

Creating files in Ruby

Hello,

I am unable to create a new file using the Ruby platform. I'm also not able to type in the terminal.
Please let me know how this can be resolved.

Thank you,

screen shot 2018-12-21 at 10 11 41 pm

toolbar disappeared in editor.

instruction is:
Get started by opening this lab with learn open or by clicking the Open button in the toolbar.

problem
no toolbar
untitled

failed

i wrote the code properly. it says i failed please help

crucial instruction missing

In between the "CREATING A FILE" paragraph and the "WRITING CODE" paragraph, there is no description of how to actually open and edit the hello_world.rb file the user has just created.

Reference to the Sublime Text simlink is moot, since subl command is not found in Learn IDE and permission to install is denied.

pls forgive my english, I'm brand new at this.

Video needs to be re-recorded

Video starts by showing the user to fork & clone. This is not the workflow we'll be recommending to users on the qualifying track. Instead, they will be told to use the open button, then learn CLI. We should be showing them how to use the workflow they are already familiar with.

cc @AnnJohn

Unable to open IDE

Hi, I'm unable to open the IDE. When I click on the open IDE button, the same instruction page opens up. Is there a solution to this issue?

Learn IDE is not connecting to server

My Learn IDE for some reason is not connecting to the server, i keep clicking to reconnect but that doesn't work, i've tried a different wifi just incase it had to do with a firewall but that led me no where. Please help!!!

Help!

The tab "Open IDE" will not open for me in Learn and I'm not sure if I can write the code on Git or if there is a way to fix IDE. Thank you!

Voice and style in README

This README uses a lot of second-person commands. It should be revised to follow Flatiron's guidelines more closely.

Unable to create file

Hi,

I am unable to create a new file in the IDE. When clicking 'Create new' and selecting 'file' it asks me what I would like the name to be and once I click 'create' the file is not created.

having refreshed the page nothing has changed.

Turn into lab first-ruby-program-hello-world

Lets turn this into a lesson with a video, the instructions, and a lab testing if they built it correctly. it's an early lesson and should be super fun and easy and interactive. I'd even add in a repl making sure they can puts and then seeing if they can git worfklow and get it all working.

Solving the exercise outside the learn IDE

I dont have my laptop now and I am using my cousin´s computer and I cannot install the IDE. I am using coder,com to study. I would like to know whether i can use it or not. How I can configure tests on coder.com

Second lab

I am on the second lab about Hello world and got lost I tried looking for a video to help me out but aim cant go further.

Cannot clone this lesson right now. Please try again.

I had this problem with lesson 1 when I typed learn open and thought it was cleared up after my time working with kwebster (I believe that was his username), where he had me make an SSH key on my github, but the issue is happening now on lesson 2. He mentioned that IDE 3 was just released this week and this may be an issue with how it deals with previous students/people who have tried the free courses with Flatiron.

Error Cloning Lesson

When I click on OPEN to load the Hello World lesson - this appears:

Forking lesson...
Cloning lesson...
There was a problem cloning this lesson. Retrying...

LEARN IDE Issue

Hello,
I have been getting this message from IDE
"WARNING: You are attempting to open a lesson that is beyond your current lesson.
Are you sure you want to continue? [Y/n]:"
I am currently on the 'Tic tac Toe' lesson

IT WONT OPEN MY TASK

Hi,

Learn IDE keeps saying error trying to copy the tasks. I don't know what to do

Learn thinks that "my local tests have not been run"

But I wasn't asked to manually run them as this is the first lesson so the learn app is doing all of the heavy lifting:
screen shot 2016-03-07 at 11 39 11 am

FWIW, even when I run "rspec" in the hello-world-ruby-Instructors directory, even after reloading the page in learn it still shows that my tests have not been run even though the command line output suggests they have been:

➜ hello-world-ruby-Instructors git:(master) rspec

Hello World
puts "Hello World!"

Finished in 0.01198 seconds (files took 0.14021 seconds to load)
1 example, 0 failures

Green means go, gray means wait for Learn to give me a fix? :)

I have been completing, successfully, labs, yet the lesson itself never gives me green. It's been a couple days since I completed the first practice lab. Still no status change. My profile shows that I am NOT in the Intro To Ruby track, yet my current track is the Ruby track -- and my activity shows that I have forked labs and submitted PRs in the track. It also states my current track is the Code Club. Please help!

Edit: Using Windows with Chrome. And the Learn IDE. :)

files not found on ruby

I am currently doing the exact steps by steps instructions on LEARN. when i creadted a file named hello_world.rb and saved it. on the terminal i typed in ruby hello_world.rb. it says no such file or directory--hello_world.rb

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.