Facebook
From Justii1311, 6 Years ago, written in Ruby.
Embed
Download Paste or View Raw
Hits: 241
  1. class Zad1
  2.         @list
  3.         def initialize
  4.                 @list = []
  5.         end
  6.        
  7.         def create(task)
  8.                 @list.push(task)
  9.         end
  10.        
  11.         def list
  12.                 puts @list
  13.         end
  14.        
  15.         def get(position)
  16.                 puts @list[position]
  17.         end
  18.        
  19.         def update(position, task)
  20.                 @list[position] = task
  21.         end
  22.        
  23.         def remove(position)
  24.                 @list.delete_at(position)
  25.        
  26.         end
  27. end
  28. x= Zad1.new
  29. x.create('Zrobic pranie xd')
  30. x.create('Zrobic zakupy xd')
  31. x.get(1)
  32. x.update(1, 'Nie zrobic zakupow')
  33. x.remove(1)
  34. x.list