Skip to content

Latest commit

 

History

History
33 lines (21 loc) · 1.3 KB

File metadata and controls

33 lines (21 loc) · 1.3 KB

Hello world

JumpStart: Lesson 8

Learning Goal

  • Write and execute Ruby code
  • Practice using irb and running Ruby files from the terminal

Overview

A Hello World program is the first program that people often write when exploring with a new programming language. In this lesson you will write a hello world program in irb and using a Ruby file. irb is great for quick exploration, and using a Ruby file is great when you want to have a record of the code that was written so it can be executed again later.

Activities

  • Read about the history of "hello, world"
  • Write and execute a hello world program in the terminal using irb
  1. Open terminal
  2. Type irb and press [enter]
  3. Type puts "Hello, World!" and press [enter]

Write a hello world program in a Ruby file

  1. Open terminal
  2. Type touch hello_world.rb to create the file
  3. Type code . to open the file in VS Code
  4. Type puts "Hello, World" and save the file
  5. In terminal type ruby hello_world.rb and press [enter]

Reflect

Reflect on the steps you completed, and try them a few more times without referencing the instructions to practice using irb and from researching online, understand the difference between print and puts methods in Ruby.