Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions ReturningValues/ReturningValues.pde
Original file line number Diff line number Diff line change
@@ -1 +1,25 @@
void setup(){
size(800,600);
}

void draw(){
//provides a, b, and c variables for calculation functions
float c = pythagorean(6, 50);
float d = addThreeNumbers(4, 4, 4);
//draws rectangles
rect(width/2, height/2, c, c);
rect(width/3, height/2, d, d);
//prints values for c and d in command line
println(c);
println(d);
}

float pythagorean(float a, float b){
float c = sqrt((a*a)+(b*b));
return c;
}

float addThreeNumbers(float a, float b, float c){
float d = (a+b+c);
return d;
}
29 changes: 29 additions & 0 deletions VoidFunctions/VoidFunctions.pde
Original file line number Diff line number Diff line change
@@ -1 +1,30 @@
void setup(){
size(600, 600);
background(0);
rectMode(CENTER);
}

void drawBlueSquare(){
float sz = 50;
fill(0, 0, 255);
rect(width/2, height/2, sz, sz);
}

void drawMouseEllipse(color userColor){
float sz = 30;
fill(userColor);
ellipse(mouseX, mouseY, sz, sz);
}

void drawRedTriangle(){
fill(255, 0, 0);
triangle(30, 75, 58, 20, 86, 75);
}

void draw(){
drawBlueSquare();
drawMouseEllipse(color(30, 150, 90));
if (mousePressed == true){
drawRedTriangle();
}
}