60 likes | 212 Vues
Discover the fundamentals of using variables in programming through engaging activities. Learn how to create and manipulate variables by utilizing the "Set" and "Change" commands to draw shapes based on variable values. This lesson allows you to explore variable-sized shapes by drawing polygons with different numbers of sides, such as triangles and octagons. Additionally, dive into the world of spirals by adjusting step sizes to create unique spirals. Get hands-on experience and enhance your coding skills while experimenting with different shapes and sizes.
E N D
Making variables • Click on the variables tab and click "Make a variable"
Set vs. Change • Set and Change look the same but are slightly different in what they do • Set [variableName] to [number] • Sets the variable to whatever the number is • Change [variableName] by [number] • Adds whatever the number is to the variable
Variable Sized Shapes • We want you to combine what you've learned about variables and shapes to fill in the blank below. • The program should draw a shape with a different number of sides based upon the value of a variable. For example, if the variable sides was 3, it would draw a triangle, if it was 8, it would draw an octagon. • For this, we need someOperators. Look in the Operators tab to see theones you can use
Drawing Spirals • If you continue to repeat while changing the size of the steps, you can create spirals • Use either the Set block or the Change block to change the size of the step after drawing a side. Use this to create a spiral. • This is a squiral (square+spiral).Experiment with differentnumbers to create other spirals.