Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

gsub

puts "The cat is here".gsub("cat", "dog")
puts "The cat is here".gsub("cat") { "dog" }

# puts "The cat is here".gsub("cat") { |match| match.reverse }
# ameba: Use short block notation instead
puts "The cat is here".gsub("cat", &.reverse)

# puts "The cat is here".gsub(/c../) { |match| match.reverse }
# ameba: Use short block notation instead
puts "The cat is here".gsub(/c../, &.reverse)