APCO 1P93 Lecture Notes - Lecture 9: Random Number Generation, Stochastic Process, Code Reuse
Document Summary
A function is a module that returns a value back to the part of the program that called it: many languages provide libraries of functions that you can use, such as random number. Generator: a function is like a module, but it returns a value that can be used in your program. Written functions that come with most languages. Usually common tasks and save time for the programmer because it allows for code reuse. The random number generator function is useful in: The function is called and a random number is returned and assigned to the variable number. 1 and 100 define the range of the number that can be returned, and are called arguments. While you can pass as many arguments into a function, you can only return one value. Functions simplify code, increase the speed of development, and ease the facilitation of teamwork. Ipo (input, processing, and output), can be used to show what a function does.