Tuesday, December 7, 2010

Customized Functions!

Would you like to shorten your programming code by a lot? Well... I introduce to you programmer-defined function!

Yes, that's right! With these custom functions, we are able to write our own subprograms, and use them in many different places. Today they were introduced to us by Mr. Arkin. Functions use the keywords function and result, and are declared in the declaration section of a program. When declaring functions, you must declare the parameters and what datatype the result will be. In the function body, there must be 1 or more statements. And of course, the function must be given an identifier, similar to variables.

After teaching us the basics of functions, we got to work on writing a few; I must say, they can get pretty complicated! For homework we are to re-do substrings assignments 10-24, using functions where possible. This should be a fun evening!

In other news, not much else happened today. On Thursday some of my friends are coming over to my house to practice for a Christmas performance; I look forward to seeing them again! But for now, it's time to tackle those substrings assignments again and functions!

No comments:

Post a Comment