Toggle value

void toggle()
{
  if(flag) { flag = false; }
  else     { flag = true; }
}
void toggle()
{
  flag = (flag)? false: true;
}
void toggle()
{
  flag = !flag;
};
void toggle()
{
  flag ^= true;
}
comments powered by Disqus