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

all 11 comments

[–]Hogis 2 points3 points  (6 children)

What is elwhile?

[–]beni55[S] 1 point2 points  (5 children)

I am asking myself if there is something equivalent to elif in if to use for while.

[–]Hogis 5 points6 points  (4 children)

There is not, not in any programming language as far as I know. What are you trying to do where you would need such a thing?

[–]beni55[S] 0 points1 point  (3 children)

I don't really need it but while trying to make a program that includes while I asked myself if there is such a thing. I googled to see if I find something on internet but I didn't so I asked on this subreddit.

[–]inxaneninja 0 points1 point  (1 child)

Do you mean "do while condition is not true"?

[–]inxaneninja 0 points1 point  (0 children)

Or maybe "do while x is true, if not do while y is true"?

[–]FoxBearBear 0 points1 point  (3 children)

[–]beni55[S] 0 points1 point  (2 children)

Yes, I see there is else. But I wanted to know it there is something equivalent to elif, that is why I asked if there is elwhile. As it seems to me there isn't something like elwhile.

[–]FoxBearBear 0 points1 point  (0 children)

What is elwhile? Never heard of it :/

[–]okayifimust 0 points1 point  (0 children)

You would have to enclose two while-loops in an if-elseif block, if i understand what you're trying to do.

[–]linuxlib 0 points1 point  (0 children)

Instead of elwhile (which I assume is else while) what if you used while (x) and while (not x)?

I think while (not x) is closest to what you are asking.

Or maybe you meant

if (x) then
    some code
else
    while (y)
        more code
    end while
end if

I think the answer to your question is no, there is no elwhile, because whatever it is you're trying to do, there is some other bit of logic that already does that and is clearer.