![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5S6HbHxoEv9RCTj6XxG7dHikr9NwrkhejFF4RVMBhI_0rjtFQx4BObfb7LJhTq5oiCqSUMQphcrJaEBrwwQFk3uaNhnDUf5ZjUh8MMUT8nF_oXRMtvufoh23S48Rdyz0bTLtVhV05ZXc/s320/day+6+pic4.PNG) |
Today I did Functions. They are used to make blocks of code usable multiple times. To create a function, we make a variable for it ex var makesquare =function(){ }; then we put code in the {} ex var makesquare = function() {rect(200,200,10,10);}; now all we have to do is type makesquare(); and it make the square and we make it so we can change the postion by in function making the x and y into variables that we determined. ex var makesquare = function(Posx,PosY){rect(200,200,10,10);}; now typing makesquare(250,204); will change the postion and u can the other ones too. Next Ill be learning logic and if statements. |
No comments:
Post a Comment