asp.net.ph

Skip Navigation LinksHome > Getting Started > ASP.NET Programming Languages Primer > Reusable Statements

ASP.NET Programming Languages Primer


Reusable Statements

In most cases, more than one statement is needed to do a certain task; and often, the same task needs to be done more than once.

Instead of writing the same statements over, you can define a method where you write the sequence of statements only once, and call the method whenever you need to perform the task.

The following example shows how a method is typicaly defined.

void methodName ( ) {
   ... statements ...
}
  C# VB JScript

  1. The first statement explicitly declares that the following code is a method block. Each method must be given a unique name.
  2. The pair of parenthesis ( ) after the method name is used to accept values, called arguments, that may be passed on to the method for certain purposes, as shall be explained later.
  3. The sequence of statements follow the method name declaration.

NOTE: C# and JScript use braces { } to specify the start and end of a method block, even if the method contains only a single statement.

After a method is defined, we can use it by simply calling its name.

... more on programming language syntax soon ...

See Also

ASP.NET Primer | Authoring an ASP.NET Page


Back to top


© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note