Results 1 to 2 of 2
  1. #1
    überfuzz is offline Member
    Join Date
    Feb 2011
    Posts
    43
    Rep Power
    0

    Default Running a script until [quit]

    I'm making a simple calculator. It does what it should do, but only one line. Now I'd like to expand it so it runs until the user writes quit, or similar.

    I run the methods handling to calculator from a method called statment(). The brilliant method I scrabbled together starts an infinite loop...

    Java Code:
    //code opening input and 
          boolean   runStatus   = true;
        while(runStatus)
          {
              map.put("ans",expression());  //expression() calculates one statement given by user.
             System.out.println(st.toString());
             if(st.isEOL())
             {
                System.out.println("Ans: " + map.get("ans"));
             }
             else if(st.getWord().equals("quit"))
             {
                runStatus = false;
             }
             else
             {
                System.out.println("Syntaxerror! Expected EOL not: "+st.toString());
             }
          }
    If anyone could give a hint on how to get the script to run one row at the time after each other.

  2. #2
    überfuzz is offline Member
    Join Date
    Feb 2011
    Posts
    43
    Rep Power
    0

Similar Threads

  1. Replies: 7
    Last Post: 11-23-2009, 09:42 AM
  2. Replies: 0
    Last Post: 08-26-2009, 02:03 PM
  3. Replies: 3
    Last Post: 04-20-2009, 10:53 PM
  4. Quit Button, Load new Frame, Timer Code
    By IHateNetbeans in forum New To Java
    Replies: 1
    Last Post: 03-18-2009, 04:58 PM
  5. Running a script within IE
    By Java Tip in forum SWT Tips
    Replies: 0
    Last Post: 07-25-2008, 03:33 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •