more changing the variable inside the loop.



Another error I encountered... I found the fix for this by reading ahead in the book.  

apparently running the 
private String promptForString(String prompt) {
  print(prompt);
  String s = input();
  return s;}

will make the while statement evaluate to true, no matter what input() it receives from the prompt.
in order for that not to happen, instead of just running
promptForString("Do some math?");
I had to assign it as the value for s.
s = promptForString("Do some math?");

I'm thinking that for whatever reason,  I'll try to google it.... The ( return s), does not change the value of s in the loop.
therefor we have to tell it to set s = promptForString();


Comments

Popular posts from this blog

JavaScript Ascii animation with while loops and console.log

playing with trigonometry sin in pygame

JavaScript and a Matrix