<s>
In	O
computer	B-General_Concept
programming	I-General_Concept
,	O
a	O
flip-flop	B-General_Concept
is	O
a	O
seldom-used	O
syntactic	O
construct	O
which	O
allows	O
a	O
boolean	O
to	O
flip	O
from	O
false	O
to	O
true	O
when	O
a	O
first	O
condition	O
is	O
met	O
and	O
then	O
back	O
to	O
false	O
when	O
a	O
second	O
condition	O
is	O
met	O
.	O
</s>
<s>
The	O
syntax	O
is	O
available	O
in	O
the	O
programming	O
languages	O
Perl	B-Language
and	O
Ruby	B-Language
.	O
</s>
<s>
Similar	O
logic	O
is	O
available	O
in	O
sed	B-Application
and	O
awk	B-Application
.	O
</s>
<s>
A	O
flip-flop	B-General_Concept
with	O
first	O
condition	O
A	O
and	O
second	O
condition	O
B	O
is	O
not	O
equivalent	O
to	O
"	O
if	O
A	O
and	O
not	O
B	O
"	O
,	O
as	O
the	O
former	O
has	O
persistent	O
state	O
and	O
is	O
true	O
even	O
if	O
A	O
is	O
no	O
longer	O
true	O
,	O
as	O
long	O
as	O
at	O
some	O
point	O
in	O
the	O
past	O
A	O
was	O
true	O
and	O
B	O
has	O
always	O
been	O
false	O
.	O
</s>
<s>
The	O
following	O
Ruby	B-Language
code	O
prints	O
the	O
numbers	O
4	O
through	O
6	O
:	O
</s>
<s>
The	O
first	O
instance	O
of	O
"	O
..	O
"	O
is	O
the	O
range	O
operator	O
,	O
which	O
produces	O
the	O
enumeration	B-Language
of	O
integers	O
1	O
through	O
10	O
.	O
</s>
<s>
The	O
second	O
"	O
..	O
"	O
is	O
the	O
flip-flop	B-General_Concept
operator	I-General_Concept
,	O
otherwise	O
known	O
as	O
the	O
flip	O
floperator	O
.	O
</s>
<s>
The	O
flip-flop	B-General_Concept
operator	I-General_Concept
needs	O
to	O
store	O
its	O
current	O
state	O
.	O
</s>
<s>
These	O
concurrent	O
accesses	O
to	O
the	O
state	O
of	O
the	O
flip-flop	B-General_Concept
operator	I-General_Concept
can	O
lead	O
to	O
undefined	O
behavior	O
,	O
or	O
at	O
least	O
surprising	O
results	O
,	O
depending	O
on	O
the	O
programming	O
language	O
.	O
</s>
<s>
For	O
example	O
,	O
in	O
Perl	B-Language
each	O
flip-flop	B-General_Concept
operator	I-General_Concept
has	O
its	O
own	O
state	O
,	O
shared	O
among	O
all	O
the	O
threads	O
,	O
the	O
other	O
programming	O
languages	O
do	O
the	O
same	O
.	O
</s>
<s>
To	O
work	O
around	O
this	O
limitation	O
,	O
the	O
flip-flop	B-General_Concept
operator	I-General_Concept
would	O
have	O
to	O
be	O
modeled	O
as	O
an	O
abstract	O
data	O
type	O
,	O
parameterized	O
with	O
:	O
</s>
<s>
a	O
predicate	O
that	O
tells	O
whether	O
to	O
switch	O
the	O
flip-flop	B-General_Concept
on	O
,	O
</s>
<s>
a	O
predicate	O
that	O
tells	O
whether	O
to	O
switch	O
the	O
flip-flop	B-General_Concept
off	O
.	O
</s>
<s>
This	O
flip-flop	B-General_Concept
data	O
type	O
would	O
provide	O
a	O
function	O
that	O
queries	O
and	O
updates	O
its	O
state	O
at	O
the	O
same	O
time	O
.	O
</s>
<s>
Due	O
to	O
this	O
inherent	O
complexity	O
,	O
only	O
few	O
programming	O
languages	O
have	O
adopted	O
the	O
flip-flop	B-General_Concept
operator	I-General_Concept
.	O
</s>
