The flow here is: if the user types open, open the already open file, break the loop, then close the file. This I don't get at all. What are you trying to achieve here?
You mean that break;
closed the file after open it?
Actually what am i want to achieve is a simple things, but i don't know how to make it.
1. It will ask the user type numbers then some alphabets.
2. The things the user typed will save the file named example.txt that i mentioned.
3. I want it open when the user typed open
and pressed enter.