questions
System, Environment
1. What is P5? How is it distinguished from Processing?
2. What does IDE stand for? Describe its components.
3. How do you save a file in the P5 editor? What naming/saving convention might you use?
4. What is a library? How do you access and use a library with P5?
5. What do the triangle and circular shapes across the top of the P5 editor represent?
6. How do you add and name an additional or new tab in the P5 editor? Why would you include more
than one tab in your program using the P5 editor?
Coding Basics
7. Describe the coordinate system used in P5.
8. What is the general syntax and structure for a line of code? Use code to demonstrate your response.
9. What is the general syntax and structure for a block of code? Use code to demonstrate your response.
10. Why are certain words in different colors in the P5 editor?
11. What is a system or reserved word in P5? List an example and explain how to use it.
12. How does order matter in P5? Give an example demonstrated with code.
13. What is the difference between mouseIsPressed and mousePressed()? Use code to demonstrate your
response.
14. What called function must always be first in setup()?
15. What is the difference between an inline comment and a block or multi-line comment? Use code to
demonstrate your response.
16. Does whitespace matter in P5? Capitalization? Use code to demonstrate your response.
Variables, Operators, Logic
17. What is a variable? What is a data type? What is a value?
18. What is the difference between a system variable and a variable that you define? Use code to
demonstrate your response
19. What is scope and how does it impact code? Use code to demonstrate your response.
20. What does it mean to declare/initialize and assign a variable? Use code to demonstrate your response
answers.
1.p5 is an IDE connected to java scrip created by Laura Macarthy.
2.IDE stands for integrated development environment and is used as a computer programing editor”environment”
3.you can save a file in p5 by calling on file at the top left and saving it as well as using the name underscore date system to orginise the files
4.the library in p5 is located on the left corner of the editor in the form of a small arrow and is used to make code files local so they can be uploaded into index.html
5.the circle with the triangle inside of it is the run button you would call to see if p5 deemed you code runnable.
6.you would add and name a new file in p5 were the plus sign is at at the top of the editor
7.the coordinates that are used in p5 is the cartesian coordinates
8.function draw() {
};
9.function setup() {
};
function draw() {
};
10.Certain words are different colors so as to be able to distinguish what that word is doing at the moment because you can use the same words and change their meanings the color change helps to read and understand the code better.
11. An example of a reserved word in p5 would be “width” and this is reserved in p5 to were when i want to make my code more module than i can use it when i am calling codes using conditional logic
12.One example of order mattering when programing is the fill() function in the sense that if you call an function() in your code before the fill() function than the fill will only apply to the functions that come after it in the code.
13.
14.The first called function in the code should be “setting up” createCanvas.
15./* here i am going to answer question 13.
Aaron*/
//var c; // variable c
this is the top of my code and as you can see the first example on the top begins with a forward slash and a star and ends with the opposite, this is a multi line comment as opposed to the latter it is represented by the forward slashes that are after the semi-colon not before
16.
17.a variable is a set of arguments/values put together as well as being a “type” of data
18.var d;
var cnv;
function setup() {
cnv=createCanvas(400, 400);
function mousePressed(changewhite) {
d=d+25;}
}
function draw() {
background(“black”);
fill(random(255), random(255), random(255));
ellipse(width/4, height/4, d, d);
}
19.
20.var d; // this line here says “var” which is me declaring the variable and the letter “d” is
var cnv; // initializing the variable
function setup() {
cnv=createCanvas(400, 400);
function mousePressed(changewhite) {
d=d+25; // this is me here assigning the variable to itself plus 25 which “assigns” the variable via the equal sign.}
}
21. p5 marks it undefined
22.nothing if the value of the variable is used it self instead of calling the value through the variable
23.It doesn’t have a value until you assign it to one
24. operators are symbols that make a code more module
25.
30. the operator “!” has the meaning of “not” which makes conditional logic more module
32. An if statement is only allowed to have one if
34. Because the rule DRY says that you want to repeat yourself as less as possible
38. that which has a word and “()” after it
40. the key-word function is like a action
44. the word function is used for p5 and method is used in javascript
45. the word arguments are used except for when they are in an function that you created
46. represents the values in a function
47. the code will not run because you are calling on something that doesn’t exist
48. the code will not run unless you call the function through dot syntax
49. the Random concept
50. Objects are buckets of codes that form something that allows you to use variables locally instead of globally.
51. constructor function
52. multiplicative inverse
54. the dot syntax is how you call values of objects
55. making a new function
57. the key word this is used to call local variables
59. an array is like an object only it has a index that allows you to use the for loop to multiply the index or to call one of the values in the index indivisual.
60. the notion for an array is “[]”
61. words are something that can be in an array and the data type that affects it is the for loop
62. an index is the concept that if you have 2 indicies in an array than to call the second one in the code you have to use the first index because the index starts from 0 leaving however many indecies you have minus one.
`