504225544 by Unknown
Author:Unknown
Language: eng
Format: epub
The function calculate_age is called once; it returns the calculated age, and this (returned) value is saved in the variable called
This variable my_age is then printed in the Output
Now that you have written the code for your new function, please do the following:
Save your code.
Check that there are no errors in the Output window and play the scene.
The console should display, amongst other things, the message âYour age is
As you can see, there are different types of methods that you can create, depending on your needs. They may or may not take parameters, and they may or may not return values.
Note that we could have specified the type of the data to be returned by the function by modifying its definition as follows (new cold in bold):
func calculate_age(YOB:int)->int:
var age:int = 2021-YOB
return (age)
We could also have specified a default value for the parameter DOB as follows (new cold in bold):
func calculate_age(YOB:int = 2000)->int:
var age:int = 2021-YOB
return (age)
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Kathy Andrews Collection by Kathy Andrews(11291)
The remains of the day by Kazuo Ishiguro(8352)
Paper Towns by Green John(4770)
Spare by Prince Harry The Duke of Sussex(4762)
The Body: A Guide for Occupants by Bill Bryson(4557)
Industrial Automation from Scratch: A hands-on guide to using sensors, actuators, PLCs, HMIs, and SCADA to automate industrial processes by Olushola Akande(4506)
Be in a Treehouse by Pete Nelson(3631)
Harry Potter and the Goblet Of Fire by J.K. Rowling(3592)
Machine Learning at Scale with H2O by Gregory Keys | David Whiting(3515)
Never by Ken Follett(3500)
Goodbye Paradise(3426)
The Remains of the Day by Kazuo Ishiguro(3115)
Into Thin Air by Jon Krakauer(3113)
The Cellar by Natasha Preston(3068)
The Genius of Japanese Carpentry by Azby Brown(3022)
Drawing Shortcuts: Developing Quick Drawing Skills Using Today's Technology by Leggitt Jim(2930)
120 Days of Sodom by Marquis de Sade(2924)
Fairy Tale by Stephen King(2897)
The Man Who Died Twice by Richard Osman(2788)
