Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class StatsVC {
- var data = [String : Stats] ()
- var current = "" // The current dataset.
- var currentdata : Stats?;
- you should write a function that returns indexes I1 -> I2 for the add command.
- write a function that sets the current dataset.
- func parseCommands(input){ // Will be seperated by spaces.
- arguments = the input string split by spaces
- check for the command (the command is the first arg){
- argument is add
- Set data of add name to all of the arguments after 1st.
- Set the current to this dataset.
- break;
- argument is current
- Set the current to this dataset.
- break;
- argument is sum
- print the sum of the current dataset
- break;
- //You will need to add the other commands, too.
- argument is write
- convert data to a string and save.
- break;
- argument is read
- convert data to multiple datasets and set "data" to those sets
- argument is help
- print the help screen.
- break
- argument is info
- idek what info is supposed to do
- break;
- not any of the arguments
- tell the user that.
- }
- }
- func runStats (){
- var Input : String?
- repeat{ // Main Loop
- Input = getLineFromConsole()
- if Input != nil && Input != "quit"{ // The input contains a command.
- parseCommands(Input!)
- }else{
- break;
- }
- }while Input != "quit"
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement