@Furry Guy your example will only work if there is initial value right ? what if theres no initial value ?
I want it to be like this.
[0]Exit
[1]Add name
[2]View name
[3]Remove name
Input: 1
------------------
Enter name: Mark
Enter any number to go back: 1
------------------
[0]Exit
[1]Add name
[2]View name
[3]Remove name
Input: 1
------------------
Enter name: Max
Enter any number to go back: 1
------------------
[0]Exit
[1]Add name
[2]View name
[3]Remove name
Input: 1
------------------
Enter name: May
Enter any number to go back: 1
------------------
[0]Exit
[1]Add name
[2]View name
[3]Remove name
Input: 2
------------------
Mark
Max
May
Enter any number to go back: 1
------------------
[0]Exit
[1]Add name
[2]View name
[3]Remove name
Input: 3
------------------
Enter the name you want to remove: Max
Enter any number to go back: 1
------------------
[0]Exit
[1]Add name
[2]View name
[3]Remove name
Input: 2
------------------
Mark
May
A lot of what you have is good. It can be simplified though.
- goto's are not a good idea - gets too complicated etc
- you'll need another option in the menu to get out of the while loop
- give the variables self explanatory names eg 'remove_this_name' doesn't leave much doubt.
- I scrapped the cls lines for clarity