Introduction Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

Write the three data types of ruby, and print the value out.

A
my_age = 18
my_boolean = true
my_name = ‘Scott’

puts my_age
puts my_boolean
puts my_name

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Do the following three things:

  • Print out your name so it’s backwards
  • Print out your name so it’s all uppercase
  • Print out your name so it’s all lowercase
A

puts ‘Scott’.reverse
puts ‘Scott’.upcase
puts ‘Scott’.downcase

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How do you write a single-line comment and how about a multi-line comment?

A

Don’t lose your focus now!

=begin
One comment
Two comment
=end

How well did you know this?
1
Not at all
2
3
4
5
Perfectly