Keep looping while + semantics and programming language

Merriam Webster says keep + verb + ing:

intransitive verb

1a: to maintain a course, direction, or progress keep to the right
b: to continue usually without interruption keep talking keep quiet keep on smiling

Keep looping does not necessarily mean one has been looping up to the moment this is said.

This question could be viewed as an ELL question. However, I am posting it here as I am looking for a two-fold confirmation: semantic/grammatical and programming language usage for purposes of confirming to skeptical French participants in the FLI forum what I have already said.

Python code snippet from Ben Stephenson's Python Manual

I was informed in the French forum that: "It's not clear to me whether the keep is very meaningful in English in such a context or just structural, but that's off topic. Consider continuer à boucler might create an ambiguity or some weirdness in this context that keep looping wouldn't introduce. This is no general context here, like keep applying pressure to the wound when someone is already doing so, surely you can see that. The 1:1 won't cut it imho" (λyoye d'oncques on French Language)

So, my question really is in English: Semantically (but not in the form used in an instruction), doesn't Keep looping while in English mean: Continue looping while? And would just using the idea of looping work? Isn't "keep" in "keep looping" meaningful? The text cited above is from an online Python course manual.

I was also informed by one poster that in English, when translating Keep verb+ing into French that: "maybe in English, you can say to someone who is thirsty, 'keep drinking until you are no longer thirsty' but in French, we'd say 'drink until you are no longer thirsty,' but not 'continue to drink until...'" ["Peut être qu'en anglais on peut dire à quelqu'un qui à soif keep drinking until you are no longer thirsty mais en français on dira bois jusqu'à ce que tu n'aie plus soif, pas continue à boire jusqu'à..."] (jlliagre on French language)

I find that rather gobsmacking. The basic idea of keep + verb+ing is simply continue to [do something]. Now, obviously, the thirst idea is really quite odd as a way to "prove" what is said in another language. However, let's play along. If someone is told me to drink water (a medical professional, for example), "Drink water until [whatever].", that is not the same thing as "Keep drinking until [whatever]".

It's rather hilarious in information theory terms that the imperative form in computer programming really means the programmer (sender) is sending a message to a language function that a machine (the recipient) will execute.

The code snippet from Python exhibits a typical instruction statement structure AKA imperative programming. Yep, instructions are written using the imperative form of verbs. Is "Loop while the user enters a non-zero number", the same as "Keep looping while the user enters a non-zero number"? If not (which I assume is correct), please state formal reasons why this is so. I assume some answers will mention iterations (repetitions) of an instruction until some "state" is reached.

Edit: Another snippet

#include<stdio.h>

int main()
{
    int i = 1;

    // **keep looping while i < 100**
    while(i < 100)
    {
        // if i is even
        if(i % 2 == 0)
        {
            printf("%d ", i);
        }
        i++; // increment i by 1
    }

    // signal to operating system everything works fine
    return 0;
}

while loop in C

Just another example.


For me, "keep looping while" in an English (not programming) usage implies that one is completing an action that one should continue to complete as long as another (at this point unspecified) thing is occurring. Keep juggling the balls while the the lights are still on. It just feels a little too open and unclear. How long and I going to do this? Are the lights going to go off?

I think programmatically while "while" may be used, in English the sense may be more of "until". Keep juggling the balls until the lights go off. Aha! A definite future event is going to happen and we are just waiting for that change of state. We can mentally track that.

"While" is like we are just killing time. "Until", to me and especially in this context, is more like we are waiting for a specific event to happen. I would write comment as "#Keep looping until user enters a non zero number." I couldn't begin to discuss the subtleties of translating that vague sense into French.


Disclaimer: My French is not good enough to verify the veracity of their claim that a simple verb carries the implication of continued action... so let's assume that it's true. It remains to recognize: Are you writing instructions in French or English? If your French Connection is to be trusted, then you should simply say Boucle, but that's no reason not to use "keep __ing" in English.

Yes, in English, "keep [X]ing" carries a different meaning than the imperative [X]. Consider: "Go"/"keep going," "look"/"keep looking." The context of talking about a loop is particularly important, since it is by definition an ongoing operation, and the question of exactly when to stop is an important one. MikeY's answer points out that a change in language can reverse the meaning ("Keep looping while X is true," vs until it is false). Since your comment is in English (rather than Python), there's nothing wrong with "keep looping" to express repeated iteration.

Disclaimer: My Python is worse than my French, but there may be other troubles. I find, like mikeY, that the only odd bit of the sentence is "while." It hints at parallel action rather than causative ("keep looping while the user whistles a tune"). You could take the suggestion of "Keep looping until the user enters 0," or, if you want to preserve the positive rather than negative syntax, perhaps "Keep looping as long as the user enters a non-zero number."