Skip to content

Latest commit

 

History

History
26 lines (20 loc) · 806 Bytes

File metadata and controls

26 lines (20 loc) · 806 Bytes

Ruby Intro

Check your ruby version

Check which version of ruby you have installed (compare this to the version that should be installed according to the instructor)

Floats and integers

What do you think happens when you combine the following floats and integers? Is the result a float or an integer? If an operator is unfamiliar, look it up and learn what it does. Check yourself using IRB.

  1. 3.0 / 2
  2. 3 / 2.0
  3. 4 ** 2.0
  4. 4.1 % 2

Strings

What do you think the output will be if you type these into IRB? Record the output you expect, and the actual (if it is different).

  1. "tom" * 3
  2. "tom" + "tom"
  3. "tom" + 1
  4. "tom" / 2

Calculations in IRB

Try these calculations in IRB

  1. How many hours are in a year?
  2. How many minutes are in a decade?
  3. How many seconds old are you?