Created
August 8, 2015 16:34
-
-
Save knehring/c6e9282bd41f592c0ce9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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