Computer Programming

© Guy Lecky-Thompson

Read the article this discussion is about

Functions

  1. johnson24
  2. Guy Lecky-Thompson


Reply   Post   Top
1.   Apr 11, 2007 7:32 PM

» johnson24 - Functions


I am new to computter programming and dont really understand the difination or purpose of a function can someone explain

-- posted by johnson24

Permalink Print Discussion Print Discussion Email Discussion Email Discussion Suite101: Functions How to subscribe to feeds

Reply   Post   Top
2.   Apr 12, 2007 12:36 AM

» Feature Writer Guy Lecky-Thompson - Functions

In response to Functions posted by johnson24:


Hello,

At the risk of blowing my own trumpet, you might like to try http://computerprogramming.suite101.com/... which discusses all manner of functions.

A quick definition might be that a function is a block of code that can be called by name. So, if you have a robot that could do all manner of different household tasks, one function might be 'WipeTable' as part of the 'CleanKitchen' program.

Now, the 'WipeTable' function could also apply to other tables that the one in the kitchen, so we might make the function capable of taking a parameter. Then we could say 'WipeTable(KitchenTable)' as part of the 'CleanKitchen' program, and 'WipeTable(LoungeTable)' as part of the 'CleanLounge' program.

Taking this a step further, there could be a 'Wipe' function, called from the 'WipeTable' function. This might be used in conjunction with other objects - 'Wipe(Table)', 'Wipe(Window)', or even 'Wipe(Floor)'.

That's the power of functions.

Best,
Guy

Suite101
Permalink Print Discussion Print Discussion Email Discussion Email Discussion Suite101: Functions How to subscribe to feeds

Please follow the guidelines set forth in the Suite101 Posting Etiquette when adding to the discussion.