Jump start: Lesson 8
- Write and execute Ruby code
- Practice using
irband running Ruby files from the terminal
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.
- Read about the history of Hello, World!
- Write and execute a hello world program in the terminal using
irb1. Open terminal 2. Typeirband press [enter] 3. Typeputs "Hello, World!"and press [enter] - Write a hello world program in a Ruby file and execute it form the terminal
1. Open terminal
2. Type
touch hello-world.rbto create the file 3. Typeatom .to open the file in Atom 4. Typeputs "Hello, World"and save the file 5. In terminal typeruby hello-world.rband press [enter] - Reflect on the steps you completed, and try them a few more times without referencing the instructions to practice