$
@
@@
?
!
(Como en x.sort!
)
=
(Por ejemplo en def x= ...
)
__FILE__
?
=begin
, =end
cuando aparecen al comienzo de una linea?
010
, 0x1F
, 0b1111
?
1_000_000
?
"\t\n"
y '\t\n'
?
%q
?
¿Qué es %q{hello world\n}
?
¿Qué es %q{'a' 'b' 'c'}
?
%Q
?
¿Qué es %Q{hello world\n}
?
¿Qué es %Q{"a" "b" "c"}
?
c
?
irb(main):001:0> a = 4 => 4 irb(main):002:0> b =2 => 2 irb(main):003:0> c = <<HERE irb(main):004:0" --#{a}-- irb(main):005:0" --#{b}-- irb(main):006:0" HERE
c
?
irb(main):001:0> a = 4 => 4 irb(main):002:0> b =2 => 2 irb(main):008:0> c = <<'HERE' irb(main):009:0' --#{a}-- irb(main):010:0' --#{b}-- irb(main):011:0' HERE
a = `ls`
. ¿Que queda en a
?
a = %x{ls}
. ¿Que queda en a
?
s = "hello"
s[0,2]
s[-1,1]
s[0,0]
s[0,10]
s[s.length,1]
s[s.length+1,1]
s[0,-1]
g
?
>> g = "hello" => "hello" >> g << " world"
e
?
>> e = '.'*3
>> a = 0 => 0 >> "#{a=a+1} "*3
[-10..0, 0..10,]
%w[this is a test]
%w[\t \n]
%W[\t \n]
nils
?
nils = Array.new(3)
zeros
?
zeros = Array.new(3, 0)
b
?
>> x = [[1,2],[3,4]] => [[1, 2], [3, 4]] >> b = Array.new(x)
c
?
>> c = Array.new(3) { |i| 2*i }
>> a = ('a'..'e').to_a => ["a", "b", "c", "d", "e"] >> a[0,0] => >> a[1,1] => >> a[-2,2] => >> a[0..2] => >> a[0...1] => >> a[-2..-1] =>
>> a => ["a", "b", "c", "d", "e"] >> a[0,2] = %w{A B} => ["A", "B"] >> a => >> a[2..5] = %w{C D E} => ["C", "D", "E"] >> a => >> a[0,0] = [1,2,3] => [1, 2, 3] >> a => >> a[0,2] = [] => [] >> a => >> a[-1,1] = [ 'Z' ] => ["Z"] >> a => >> a[-2,2] = nil => nil >> a =>
>> a = (1...4).to_a => >> a = a + [4, 5] => >> a += [[6, 7, 8]] => >> a = a + 9
>> a = [] => [] >> a << 1 => >> a << 2 << 3 => >> a << [4, 5, 6] => >> a.concat [7, 8] =>
>> x = %w{a b c b a} => >> x = x - %w{b c d} =>
>> z = [0]*8 =>
>> a = [1, 1, 2, 2, 3, 3, 4] => [1, 1, 2, 2, 3, 3, 4] >> b = [5, 5, 4, 4, 3, 3, 2] => [5, 5, 4, 4, 3, 3, 2] >> c = a | b => >> d = b | a => >> e = a & b => >> f = b & a =>
Casiano Rodriguez León 2015-01-07