...

/

Bangs

Bangs

This lesson gives an introduction to bang methods in Ruby.

Bang Methods

All of the examples that we’ve discussed before have one thing in common:

They are questions and do not modify the object they are called on.

For example:

name = "Ruby Monstas"
puts name.downcase
puts name

This will output:

ruby monstas
Ruby Monstas
Press + to interact
name = "Ruby Monstas"
puts name.downcase
puts name

As you can see the method downcase has returned a new String, which is ...

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy