An Intro to Ruby

Purpose

Get started with Ruby

Preparation

You will be getting started with Ruby on your own.

Lesson

Self-test

Terms in bold are especially important.

  1. What is an expression?
  2. Does ruby need a main method? Why or why not?
  3. Blocks in Ruby are required to have braces: true/false
  4. Explain the conventions for adding ? and ! to the end of a method name.
  5. What does it mean to be immutable? Which data type is mutable in Ruby but immutable in Java?
  6. What is string interpolation? How does this compare to string concatenation?
  7. The latest version of Ruby has a character data type: true/false
  8. What’s the value of f(3+2)+1{.ruby} (for some function f)?
  9. What’s the value of f (3+2)+1{.ruby} (for some function f)?
  10. What is the purpose of a negative subscript in Ruby?

Submit/Rubric

Nothing to submit, but be sure to have a solid start with Ruby – the course builds up fast!