slashdemonofthesword

Haxe: User Interative List Saving Program

Aug 8th, 2016
583
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import sys.io.File;
  2.  
  3. class ListProgramOne {
  4.  
  5.     public static function main(){
  6.  
  7.         var items = new List<String>();
  8.         var input;
  9.         var output;
  10.  
  11.         Sys.println("Welcome to the Console/Terminal Haxe List Program");
  12.         Sys.println("Here's your current list: ");
  13.  
  14.        
  15.  
  16.         Sys.println("");
  17.        
  18.         Sys.println(File.getContent("/Users/admin/Desktop/ListProgram/list.txt"));
  19.  
  20.         trace("Would you like to edit (e) / quit (q)");
  21.        
  22.         input = Sys.stdin().readLine();
  23.         input.toLowerCase();
  24.  
  25.         if(input == "e") {
  26.  
  27.             while (input != "QUIT")
  28.             {
  29.                 Sys.println("New Item: ");
  30.                 input = Sys.stdin().readLine();
  31.                 items.add(input);
  32.                 Sys.println("--------");
  33.  
  34.  
  35.  
  36.                
  37.  
  38.             }
  39.  
  40.                        
  41.  
  42.         }
  43.  
  44.         items.remove("QUIT");
  45.  
  46.         Sys.println("--------Current List---------");
  47.         for (i in items)
  48.         {
  49.             Sys.println(i);
  50.            
  51.             output = File.append("/Users/admin/Desktop/ListProgram/list.txt", false);
  52.             output.writeString(i + "\n");
  53.             output.close();
  54.  
  55.        //  File.saveContent("/Users/admin/Desktop/ListProgram/list.txt", items.toString() + "\n");
  56.            
  57.  
  58.         }
  59.  
  60.     }
  61.  
  62. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×