An Intro to Ruby
Purpose
Get started with Ruby
Preparation
You will be getting started with Ruby on your own.
- Take a look at the Ruby intro slides
- As instructed at the end of the slides, play with the the Ruby basics file
- If you haven’t already, clone the class Git repo
- In git bash:
git clone https://github.com/dgrisham/csci400
- All of the lectures, example code, assignments, etc. are hosted here
- In git bash:
Lesson
Self-test
Terms in bold are especially important.
- What is an expression?
- Does ruby need a
main
method? Why or why not? - Blocks in Ruby are required to have braces: true/false
- Explain the conventions for adding
?
and!
to the end of a method name. - What does it mean to be immutable? Which data type is mutable in Ruby but immutable in Java?
- What is string interpolation? How does this compare to string concatenation?
- The latest version of Ruby has a character data type: true/false
- What’s the value of
f(3+2)+1
{.ruby} (for some functionf
)? - What’s the value of
f (3+2)+1
{.ruby} (for some functionf
)? - 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!