Examples of functions with parameters

stage.set_background_color("silver") #stage.set_background("grid") # functions look like this # def is short for 'define' #def functionName(parameter): # do something right here # don't forget to indent hedgie = codesters.Sprite("hedgehog") ## here is our function def hedgieMoveRight(numberOfSpacesToMove): hedgie.move_right(numberOfSpacesToMove) hedgie.say("OK, I moved " + str(numberOfSpacesToMove) + " spaces!"); stage.wait(3) hedgie.say("") # here is where we call our function hedgieMoveRight(10); hedgieMoveRight(15); hedgieMoveRight(30); hedgieMoveRight(50);
Support