diff options
author | Jacob Ward <jacobward1898@gmail.com> | 2015-10-26 23:03:37 -0600 |
---|---|---|
committer | Jacob Ward <jacobward1898@gmail.com> | 2015-10-26 23:03:37 -0600 |
commit | a0eb996415cc86cb72c44e793ebfacc3ec2d7b17 (patch) | |
tree | 516c83684b752f374758b9abd3b89be723478fd3 /ruby.html.markdown | |
parent | 66bc42e31bf62a1592f9b763e12c0b963b3e7d3d (diff) | |
parent | 44ca091c73afe13ec8760021cfed1d77afc5e4a5 (diff) |
Merge remote-tracking branch 'adambard/master'
Diffstat (limited to 'ruby.html.markdown')
-rw-r--r-- | ruby.html.markdown | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/ruby.html.markdown b/ruby.html.markdown index 0e798706..998b4bf7 100644 --- a/ruby.html.markdown +++ b/ruby.html.markdown @@ -12,7 +12,8 @@ contributors: - ["Dzianis Dashkevich", "https://github.com/dskecse"] - ["Levi Bostian", "https://github.com/levibostian"] - ["Rahil Momin", "https://github.com/iamrahil"] - - ["Gabriel Halley", https://github.com/ghalley"] + - ["Gabriel Halley", "https://github.com/ghalley"] + - ["Persa Zula", "http://persazula.com"] --- ```ruby @@ -40,6 +41,7 @@ You shouldn't either 35 / 5 #=> 7 2**5 #=> 32 5 % 3 #=> 2 +5 ^ 6 #=> 3 # Arithmetic is just syntactic sugar # for calling a method on an object @@ -107,6 +109,12 @@ placeholder = 'use string interpolation' 'hello ' + 3 #=> TypeError: can't convert Fixnum into String 'hello ' + 3.to_s #=> "hello 3" +# Combine strings and operators +'hello ' * 3 #=> "hello hello hello " + +# Append to string +'hello' << ' world' #=> "hello world" + # print to the output with a newline at the end puts "I'm printing!" #=> I'm printing! @@ -284,7 +292,7 @@ end #=> iteration 4 #=> iteration 5 -# There are a bunch of other helpful looping functions in Ruby, +# There are a bunch of other helpful looping functions in Ruby, # for example "map", "reduce", "inject", the list goes on. Map, # for instance, takes the array it's looping over, does something # to it as defined in your block, and returns an entirely new array. |