View Single Post
  #2 (permalink)  
Old 03-30-2008, 09:28 PM
shaalini shaalini is offline
D-Web Analyst
 
Join Date: Apr 2007
Posts: 342
shaalini is on a distinguished road
Default Re: Ruby BuiltIn functions

A function is "a portion of code within a larger program, performs a specific task".

Functions have many benefits including:

1. reducing the duplication of code in a program (e.g., by replicating useful functionality, such as mathematical functions);
2. enabling reuse of code across multiple programs;
3. decomposing complex problems into simpler pieces (this improves maintainability and ease of extension);
4. improving readability of a program;
5. hiding or regulating part of the program.

Functions are also know under many other names such as subroutines, methods or subprograms

abort
Array
at_exit {...}
binding
block_given?
callcc {| c|...}
caller([ n])
catch( tag) {...}
chomp([ rs=$/])
chomp!([ rs=$/])
chop
chop!
eval( str[, scope[, file, line]])
exec( cmd[, arg...])
exit([ result=0])
exit!([ result=0])
fail(...)
Float( obj)
fork
fork {...}
format( fmt[, arg...])
gets([ rs=$/])
global_variables
gsub( x, y)
gsub( x) {...}
gsub!( x, y)
gsub!( x) {...}
Integer( obj)
lambda {| x|...}
proc {| x|...}
lambda
proc
__________________
Shaalini.S
Be the Best of Whatever you are...
Reply With Quote