I am experienced in python but completely new to java. I am using p5 and want to set up a simple function that, depending on what number the user inputs, it draws that many circles. I'm not sure why it is not working.
var numProton;
function setup() {
numProton = createInput();
numProton.changed(nucleus);
createCanvas(600, 500);
background(255);
}
function draw() {
noStroke()
textSize(15);
fill(0, 0, 0);
text('^ # of Protons', 25, 30);
text('^ # of Neutrons', 150, 30);
text('^ # of Electrons', 275, 30);
}
function nucleus() {
var i = 0;
while(i <= numProton.value) {
ellipse(300, 250, 10);
i++;
}
}
Probably a very simple error but I appreciate the help none the less.