procedures in MEL:

declaring a procedure - use the "proc" keyword

     proc myProc( ) {

If you execute this in the script editor, it will look like nothing happens. 
However, the procedure "myProc" will have been declared and ready for execution
whenever you call the procedure:

     myProc( );

Passing values to a procedure:

     proc myProc( int $count, float $size ) {
          for ($i = 1; $i <= $count; $i++ )
               sphere -r $size;

In the above example, you now need to give the procedure the necessary inputs:

    myProc( 5, 3.5 );
    myProc 5 3.5;

Procedures that return a value (the MSMA book calls this a function):
Put a data type for the returned value after the "proc" keyword. You must then include the "return" command somewhere in the procedure. proc float myProc( float $input ) { float $squared = $input * $input; return $squared; } If you call this procedure, you can get back the result: float $squaredResult = myProc( 6 ); LOCAL vs GLOBAL: Declaring a global procedure - just use the "global" keyword: global proc myProc( ) { statements_to_execute; } By default, a procedure is "local". A local procedure can only be called from within the script in which it exists. A global procedure can be called using the command line or by any other script, expression, or script node during the maya session. Often, a script will have one global procedure (perhaps the one that sets up a GUI or takes input from the command line). The remaining procedures in the script handle tasks after the global procedure has been called, for purpose of organization and structured programming. Sometimes a set of scripts are incorporated to create a sophisticated "tool set" (perhaps
after creating a new shelf tab with a number of custom shelf buttons, etc.). In cases like this, there may be global procedures that are shared by multiple scripts, avoiding repetition and ensuring continuity. External Script Files: A procedure needs to be global for maya to find it in the external script paths, without the need to first use the "source" command or menu option. If you create a new script file and save it in your script path(s), use the command "rehash" for maya to re-scan the files so that it can find the new procedures.