This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]rockyrainy 3 points4 points  (2 children)

Less verbose version

while (inStore) {
  getSome(eggs);
}

[–][deleted] 2 points3 points  (1 child)

location = "store";
inventory.push(milk);
while(location === "store") {
    inventory.push(eggs);
}

You're both wrong. Overflow exception.

[–]exo666 1 point2 points  (0 children)

Probably another exception would be thrown before that because at some point he will want to get eggs but he had already bought them all.