دستگاه خود را بچرخانید.
قفل جهتیابی را در تنظیمات دستگاه خاموش کنید.
مرورگر شما پشتیبانی نمیشود. لطفا مرورگر خود را به [یکی از مرورگرهای تحت پشتیبانی ما] [one of our supported browsers] https://support.code.org/hc/en-us/articles/202591743 بروزرسانی کنید. میتوانید محتویات صفحه را مشاهده کنید، اما عملکرد آن مطلوب نخواهد بود.
CS in Algebra curriculum and content is being deprecated. Within the next few months, this lab will no longer be available. Please check out Bootstrap: Algebra instead. Learn More.
دستگاه خود را بچرخانید.
قفل جهتیابی را در تنظیمات دستگاه خاموش کنید.
Edit the the patrol
function to add an actor
parameter, so that we can call it for each of the actors on the screen. Remember, the actors correspond to numbers 1, 2, and 3.
This is a modal window.
Beginning of dialog window. Escape will cancel and close the window.
End of dialog window.
Here's a function that draws a square with 50 pixel sides. That's great but what if I wanted to draw a square with sides 50 pixels and another square with sides of 100 pixels? We shouldn't have to make two separate functions that do almost the same thing. Instead, we can use one function with a parameter.
Parameters allow us to pass values into a function that get used as variables inside the function. Let's try adding a parameter called like to this function so we can use it to create squares of different sizes. In the function editor, you can edit the name and description like before but now you can also add a parameter. Write the name of your parameter in the space and click Add Parameter. This will create a red block with the name of the parameter you just created. Now we can replace the move forward by 100 block with the parameter Length so it will move forward by Length.
Click save and close and drag out your new create a square block from the functions category in the toolbox. You'll notice there's an empty space next to length because the function wants to know what value the parameter Length should have. Drag a number block from the Math category and place it in this space. See how you can use the function again and again with different lengths to make squares of different sizes? Try it for yourself!