Ruby Strings

Ruby Strings

The Ruby strings syntax and example.

Strings syntax

puts "This is a string."
puts 'String syntax'

Strings example

puts "This is a string."
puts 'String syntax'

puts "abc - 123"
puts "1234567"

puts "Concatenate string A" + "BCDE"

puts "Ruby string. \nTest new line."

a, b = 2, 3
puts "A = #{ a }"
puts "A + B = #{ a + b }"

Output

This is a string.

String syntax

abc – 123

1234567

Concatenate string ABCDE

Ruby string.

Test new line.

A = 2

A + B = 5