-
-
Save jasondavis/d30b9efc5c39cbb0a8c7c8a77a655047 to your computer and use it in GitHub Desktop.
/r/DailyProgrammer [2015-06-15] #218 [Easy] To Do List
This file contains hidden or 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
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