Computer Science 1026A/B Chapter Notes - Chapter 5: Local Variable, Stochastic Process

47 views5 pages
terubarenuka and 39895 others unlocked
COMPSCI 1026A/B Full Course Notes
26
COMPSCI 1026A/B Full Course Notes
Verified Note
26 documents

Document Summary

Device with given specification but unknown implementation: e. g. we know round function rounds to x number of decimal places but we don"t know how. Function: sequence of instructions with a name. Call a function in order to execute its instructions. E. g. you call round function, the instructions of round function executes & computes the results since it returns its result back to where the function was called & program resumes execution. Arguments are supplied when function is called (values for which we want the function to compute a result: inputs when calling a function. Output: return value price = round(6. 8275, 2: e. g. when round function returns its results, the return value is stored in the variable price. Functions can receive multiple arguments (instructions) but can only return one value. Functions don"t need arguments: e. g. random function requires no argument to produce random number. Do not confuse return value with print statement. Whereas return value can be stored for future uses.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents