Last active
February 17, 2018 01:16
-
-
Save errorseven/67d6245a8ead590137e3605cee2c7a6a 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