Skip to content

Instantly share code, notes, and snippets.

@jasondavis
Forked from errorseven/ToDoList.ahk
Created February 17, 2018 01:16
Show Gist options
  • Save jasondavis/d30b9efc5c39cbb0a8c7c8a77a655047 to your computer and use it in GitHub Desktop.
Save jasondavis/d30b9efc5c39cbb0a8c7c8a77a655047 to your computer and use it in GitHub Desktop.
/r/DailyProgrammer [2015-06-15] #218 [Easy] To Do List
MyList := New ToDo()
MyList.Set("Go Shopping")
MyList.Set("Go to bank")
MyList.Display()
MyList.Set("Buy Fallout 4")
MyList.Remove("Go to bank")
MyList.Display()
Class ToDo {
__New() {
global
this.list := []
}
Set(x) {
this.list.Insert(x)
}
Remove(x) {
For each, value in this.list {
If (value == x)
this.list.Remove(A_Index)
}
}
Display() {
Loop % this.list.MaxIndex() {
x .= this.list[A_Index] . "`n"
}
MsgBox % x
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment