Welcome to Scribd. Sign in or start your free trial to enjoy unlimited e-books, audiobooks & documents.Find out more
Download
Standard view
Full view
of .
Look up keyword
Like this
1Activity
0 of .
Results for:
No results containing your search query
P. 1
Lecture 8 - Methods_SP1_2007

Lecture 8 - Methods_SP1_2007

Ratings:

4.0

(1)
|Views: 11|Likes:
Published by curlicue

More info:

Published by: curlicue on Oct 21, 2008
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

05/09/2014

pdf

text

original

 
Lecture 8: Methods
 
Outline
In this lecture, we will discuss buildingMethods
Little mini-programs within our program
To do sub-tasks for us.
Sometimes, methods are also calledprocedures.
There are two types of Methods:
Subroutines:Methods that do not return a value.
Private Subroutines:
That respond to a user input.
General (Sub) Subroutines:
Which can be called publicly.
Functions:Methods that return a value.
We will look at examples of both types.
 
Methods
Now that we know some basics…
Data classes:variables;
The basics of process control:Conditional statementsandLoops. …We are set to discussMethods.
AMethodis a self-contained block of code that ‘does something’.
In other words, it performs its own isolated task.
Can be thought of as a ‘mini-program’.
Methods are thus very useful for modularizing our program:
Organizing code into logical, independent tasks;
This is helpful forRe-usability
Creatingreusable blocks.
Also helpful for easyprogram maintenance.
Required changes to update a method’s behavior are made in themethod…

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->