Today I Learned

A Hashrocket project

Ready to join Hashrocket? Find Openings here and apply today.

Repeat a string in swift like ruby

Repeating a string is very easy to do in ruby:

puts "a" * 5
=> "aaaaa"

Swift uses a string function:

print String(repeating: "a", count: 5)
=> "aaaaa"