User-defined Functions (3/28) Scripts A function is a black box that gets some input and produces some output We do not care about the inner workings of a function Functions provide reusable code Functions have private workspaces The only variables in the calling program that can be seen by the function are those in the input list The only variables in the function that can be seen by the calling program are those in the output list 同停大学 TONGJI UNIVERSITY A function is a black box that gets some input and produces some output We do not care about the inner workings of a function Functions provide reusable code Functions have private workspaces ✓ The only variables in the calling program that can be seen by the function are those in the input list ✓ The only variables in the function that can be seen by the calling program are those in the output list User-defined Functions (3/28) Scripts