learn_ruby_ch4_pt1 Flashcards

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

Get information on the String instance method chop

A

ri String#chop [or] ri String.chop

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

Create a new empty string called title

Validate it is empty

Check its size

A

title = String.new # => “”

title. empty? # => true
title. length [or] title.size # => 0

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

Show three ways to create a new string of “Much Ado about Nothing”

A

title = String.new( “Much Ado about Nothing” )

title = String( “Much Ado about Nothing” )

title = “Much Ado about Nothing”

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

Delimit strings with !, [ ], and ( )

A
comedy = %!As You Like It!
history = %[Henry V]
tragedy = %(Julius Ceasar)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Indented “here” document

A
ind = <<-hello # for indentation
    Hello, Matz!
hello
How well did you know this?
1
Not at all
2
3
4
5
Perfectly