Coder Social home page Coder Social logo

irb-readme-bootcamp-prep-000's Introduction

Introduction to IRB. Love this.

Objectives

  1. Describe IRB and why it's useful when programming.
  2. Distinguish IRB from your terminal and other files.
  3. Access and exit IRB via your terminal.
  4. Execute commands in IRB.
<iframe width="960" height="720" src="https://www.youtube.com/embed/WWh1uxqQI48?rel=0&showinfo=0" frameborder="0" allowfullscreen></iframe>

MP4

What is IRB?

IRB stands for "Interactive Ruby." It's a Ruby shell or REPL. REPL stands for read–eval–print loop. It is a simple, interactive computer programming environment that takes user inputs (such as, in our case, snippets of Ruby code), evaluates them, and returns the result to the user. IRB is run by your computer's terminal. You can think of it as your Ruby playground or execution environment. You can open it up, insert code and execute it to see that code's return value.

What isn't IRB?

IRB is not a file where you save your work. Any coding you do in the IRB console in your terminal will not get saved anywhere. It exists temporarily only. IRB is for testing, playing, manipulating your code so that you understand it better and solve problems with it.

How do you use it?

IRB allows you to execute ruby in the terminal and you're going to get comfortable using it to test and better understand your Ruby code. To access IRB, just type irb in the terminal. IRB allows you to do anything you can do in a Ruby file. For instance, you can do math, get the time by typing Time.now, or print text to the screen.

Instructions

  1. Open up your terminal. (If you do not have a terminal on your computer you can use repl.it)
  2. Type irb and hit return
  3. Now that you've started IRB, type the commands below to see how it works! Type each of the following lines into the irb shell and press enter.
  • Time.now
  • 255 / 5
  • 9 ** 2
  • puts "hello world"
  1. To leave irb, type the exit command - this will get you back to your command line.

View Introduction to IRB on Learn.co and start learning to code for free.

irb-readme-bootcamp-prep-000's People

Contributors

ahimmelstoss avatar annjohn avatar arelenglish avatar aviflombaum avatar awesomescot avatar clickdees avatar deniznida avatar dfenjves avatar fislabstest avatar fs-lms-test-bot avatar kthffmn avatar ruthmesfun avatar sarogers avatar sophiedebenedetto avatar

Watchers

 avatar  avatar

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.