# Trying to understand why a boolean is returning true

**URL:** <https://discourse.processing.org/t/trying-to-understand-why-a-boolean-is-returning-true/25779>\
**Category:** Libraries\
**Created:** [November 28, 2020, 2:22am UTC](https://discourse.processing.org/t/trying-to-understand-why-a-boolean-is-returning-true/25779 "2020-11-28T02:22:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![crimpqwe](https://avatars.discourse-cdn.com/v4/letter/c/53a042/32.png) [@crimpqwe](https://discourse.processing.org/u/crimpqwe)\
**Post date:** [November 28, 2020, 2:22am UTC](https://discourse.processing.org/t/trying-to-understand-why-a-boolean-is-returning-true/25779/1 "2020-11-28T02:22:27Z")

</div>

```auto
import controlP5.*;
boolean button1 = false, button2 = false, button3 = false;
ControlP5 cp5;
float bg = random(255);
 
void setup() {
  size(1200, 750);
 
  cp5 = new ControlP5(this);
 
  cp5.addButton("A")
    .setPosition(100, 100)
    .setSize(10, 10);
    
    
  cp5.addButton("B")
    .setPosition(200, 200)
    .setSize(10, 10)
    ;
      
   cp5.addButton("buttonC")
    .setPosition(300, 300)
    .setSize(19, 19)
    ;

    }

void draw() {
background(bg);
  if ((button1 == true) && (button2 == true)); {
          line(100,100,200,200);
    }
    if (button1 == true) {
            pushMatrix();
  translate(105, 105);
  rotate(frameCount / -100.0);
  star(0, 0, 10, 25, 5); 
  popMatrix();
    } if (button2 == true) {
                 pushMatrix();
  translate(205, 205);
  rotate(frameCount / -100.0);
  star(0, 0, 10, 25, 5); 
  popMatrix();
    }

  }

public void A() {
    println("hello" + button1);
        button1= true;
 
          
 }

public void B() {
    println("hellAAAAo" + millis());
    bg = random(255);
        button2= true;
 }
 public void buttonC() {
    println("hello" + millis());
    bg = random(255);
        button3= true;
 }
void star(float x, float y, float radius1, float radius2, int npoints) {
  float angle = TWO_PI / npoints;
  float halfAngle = angle/2.0;
  beginShape();
  for (float a = 0; a < TWO_PI; a += angle) {
    float sx = x + cos(a) * radius2;
    float sy = y + sin(a) * radius2;
    vertex(sx, sy);
    sx = x + cos(a+halfAngle) * radius1;
    sy = y + sin(a+halfAngle) * radius1;
    vertex(sx, sy);
  }
  endShape(CLOSE);
}

```

```
if ((button1 == true) && (button2 == true)); {
      line(100,100,200,200);

```

ive played with this for some time but i cant get to grips with why the line is being drawn at the start of the sketch.  
thanks for any advice

---

<div class="post-metadata">

**Author:** ![crimpqwe](https://avatars.discourse-cdn.com/v4/letter/c/53a042/32.png) [@crimpqwe](https://discourse.processing.org/u/crimpqwe)\
**Post date:** [November 28, 2020, 4:49am UTC](https://discourse.processing.org/t/trying-to-understand-why-a-boolean-is-returning-true/25779/2 "2020-11-28T04:49:12Z")

</div>

nevermind i think it was just a misplaced semicolon hehe
