Skip to content

Instantly share code, notes, and snippets.

@knehring
Created August 8, 2015 16:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save knehring/c6e9282bd41f592c0ce9 to your computer and use it in GitHub Desktop.
Save knehring/c6e9282bd41f592c0ce9 to your computer and use it in GitHub Desktop.
class ToDoList
def initialize
@itemList = []
end
def addItem(item)
@itemList.push(item)
end
def deleteItem(item)
@itemList.each do |key|
if key == item
@itemList.delete(item)
end
end
end
def viewList
@itemList.each do |item|
puts item
end
end
end
todo = ToDoList.new
todo.addItem("Cats")
todo.addItem("Dogs")
todo.viewList()
todo.deleteItem("Dogs")
todo.viewList()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment