Dear Madam,
I'm looking for the GOTO statement
that leads me out of the life while
loop, or a way to set the chasing
and working booleans to false.
The chasing and working booleans
seem to be permanently set to
true.
Would you be so kind as to advise
where one can find the nearest
early exit point?
working:= true;
chasing:= true;
while (working) and (chasing) do
begin
//...
// dissatisfied
// burnt out
// need a break
// save me
//...
end;
Regards,
Secret Agent 505
Madam responds:
Dear Agent 505,
I assume you are a young man and
have not found your love or
retirement yet.
The while loop must go on, don't
sweat it.
The chasing boolean may be set to
false narrowing down the risk of
being caught in the while loop,
but only if you can find her and
convince her to set the boolean.
Even then, this may increase
the chances of working boolean to
being true for longer.
The working boolean is essential
and cannot be changed until you are
much older, but I assume you know
this.
The GOTO statement possibility
also exists and is more dramatic.
Consider using it when life gets
extremely complicated and you
need to take a break and do some
special activities.
In fact, you should place more
activities into the while loop
by calling some procedures from
within it, instead of using
GOTO statements.. but if life
gets too complicated, and you
are old enough, or you have
enough money, you may use a
GOTO statement to retire early.
Otherwise, the loop will have
to end later and follow through
with the retirement then.
Consider:
procedure life;
var working, chasing: boolean;
procedure seenature;
begin
Walk;
if personavailable then
begin
holdhands;
chasing:= false;
end;
SeeFlowers;
SeeTrees;
end;
procedure rest;
begin
if personavailable then
begin
romance;
chasing:= false;
end;
sleep;
end;
procedure chase;
begin
SeeNature;
// you may find her there, but try other activities here too
end;
begin
working:= true;
chasing:= true;
while (working) or (chasing) do
begin
if (extramoney) and (secure) then goto retire;
if day = lessbusy then seenature;
if reallydark then rest;
if chasing then chase;
Organize;
Plan;
Prepare;
Work;
// .. etc
end;
retire:
begin
DoLastActivities;
exit;
end;
end;
Regards,
Madam
|