Strings

String match

a="Hello"
if a.match /[a-zA-Z]/
 puts "It's a match!"
end

a="Hello"
if a=~/[a-zA-Z]/
 puts "It's a match!"      #Better
end

String repetition

6.times do
 print "Hello"
end

print "Hello"*6 #Better

Single char

puts "A"

puts ?A #Better

Char ascii

puts 70.chr

putc 70 #Better

\n shortcut

a=gets.split "\n"

a=gets.split $/ #Better