fork download
  1. # your code goes here
  2. a = [0,1,2,3,4,5,6,7,8,9]
  3.  
  4. b = a.slice( 2,2 )
  5.  
  6. puts "slice:"
  7. puts " a = " + a.inspect
  8. puts " b = " + b.inspect
  9.  
  10. b = a.slice!(2,2)
  11. puts "slice!:"
  12. puts " a = " + a.inspect
  13. puts " b = " + b.inspect
  14.  
  15.  
Success #stdin #stdout 0.01s 7456KB
stdin
Standard input is empty
stdout
slice:
  a = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
  b = [2, 3]
slice!:
  a = [0, 1, 4, 5, 6, 7, 8, 9]
  b = [2, 3]