TIP: Click on subject to list as thread! ANSI
echo: rberrypi
to: KIWI USER
from: THE NATURAL PHILOSOPHER
date: 2018-02-21 17:46:00
subject: Re: How to use while loop

On 21/02/18 15:46, Kiwi User wrote:
> On Wed, 21 Feb 2018 09:34:34 -0500, Dennis Lee Bieber wrote:
>
>> On Wed, 21 Feb 2018 07:10:30 +0000, The Natural Philosopher
>>  declaimed the following:
>>
>>
>>> print(last==readpin()?((last=readpin()==OPENED)?"Opened":"Closed"):"");
>>>
>>> I knew one line was possible!
>>
>>  That's not Python. Assignment is not an expression in Python but a
>> statement.
>>
> Besides, the while loop somehow vanished into thin air.
>
>
well that can all be on a single line, in C..

In fact a whole program can be a single line, as the compiler skips
white space: All that matters is the semicolon...

So
while (1)
printf(last==readpin()?((last=readpin()==OPENED)?"Opened":"Closed"):"");

is a single line while loop

--
"The great thing about Glasgow is that if there's a nuclear attack it'll
look exactly the same afterwards."

Billy Connolly

--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)

SOURCE: echomail via QWK@docsplace.org

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.