ASP.NET
  Home arrow ASP.NET arrow ASP.NET Basics (Part 6): Fully Function-al
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
ASP.NET

ASP.NET Basics (Part 6): Fully Function-al
By: Harish Kamath (c) Melonfire
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 8
    2003-11-11

    Table of Contents:
  • ASP.NET Basics (Part 6): Fully Function-al
  • The Right Spirit
  • Turning Up the Heat
  • Sweet Tooth
  • Passing the Buck
  • Going Nowhere
  • First Date
  • Flavor of the Month

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    ASP.NET Basics (Part 6): Fully Function-al


    (Page 1 of 8 )

    asp.netFind out how to modularize your code in C# by abstracting it into functions. This segment of our ASP.NET tutorial covers defining and invoking functions, function return values and function arguments, together with a discussion of variable scope within an ASP.NET script.All the code you've seen over the past few weeks has been what might be called linear - written such that it is executed sequentially, one line after another. Sure, I've added a few "if" and "for" loops for variety, and even thrown in a "switch" here and there to break up the monotony - but by and large, the code in previous sections has been written to resemble a straight line.

    Well, it's time to add a few swoops and swirls to the way you code, just to make sure you don't get bored (this also comes in handy if you need to confuse your boss). Enter this week's tutorial, which attempts to address the problem by teaching you all you need to know about a programming construct called a "function."

    Ask a geek to define the term "function", and he'll probably tell you that a function is "a block of statements that can be grouped together as a named entity." Since this is a tutorial on ASP.NET, not the language Geek, I'll simplify that definition a little: a function is simply a set of program statements which perform a specific task, and which can be "called", or executed, from anywhere in your program.

    Every programming language comes with its own built-in functions and typically also allows developers to define their own functions. For example, if I had a series of numbers, and I wanted to reduce each of them by 20%, I could pull out my calculator and do it manually, or I could write a simple C# function called cheatTheTaxman() and have it do the heavy lifting for me.

    There are two important reasons why functions are a Good Thing. First, a user-defined function allows you to separate your code into easily identifiable subsections, thereby making it easier to understand and debug. And second, a function makes your program modular, allowing you to write a piece of code once and then re-use it multiple times within the same program.

    More ASP.NET Articles
    More By Harish Kamath (c) Melonfire


     

    ASP.NET ARTICLES

    - Adding Content to a Static ASP.NET Website
    - Building a Static ASP.NET Website in a Basic...
    - Develop Your First ASP.NET Website with Visu...
    - Run ASP.NET in Windows XP Home with Cassini ...
    - How to Test a Web Application
    - How to Add Code and Validation Controls to a...
    - Working in Source and Split Views to Build a...
    - How to Build a Web Form for a One-Page Web A...
    - How to Develop a One-Page Web Application
    - An ASP.NET Web Application in Action
    - Developing ASP.NET Web Applications
    - An Introduction to ASP.NET Web Programming
    - Introduction to the ADO.NET Entity Framework...
    - Completing an In-Text Advertising System und...
    - Programming an In-Text Advertising System un...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek