if started=true then started:=false;
if started=false then started:=true;
Assuming that, since you've shown it as valid Pascal syntax, that's an attempt at working code, then
started := true;Now, noting the other (probably more helpful :-) answer you've been given, consider what you really asked:
if started=true then started:=false;
// If started was true, it's now false.
// If started was false, it's still false.
// Hence in all cases: started is now false.
if started=false then started:=true;
// We know that started was false, hence it must become true.
What you probably meant to ask was
if started = true then
started := false
else
if started = false then
started:=true;
But if the else is taken started must be false therefore the second test is redundant, hence
if started = true then
started := false
else
started := true;
Hence, assuming that that was what you meant,
That's the problem with computers: they'll do exactly what you tell them, even if it's not what you mean :-)
MarkMLl