Florence nightingale

1043 palabras 5 páginas
picThe Structured Approach - Using Subroutines and Functions
Subroutines and functions enable you to divide a program into smaller parts. A subroutine or function is a named group of statements, constants, variables and other declarations that perform a particular purpose. A function is identical to a subroutine in every respect, with the one exception: it can return a single value to the calling program. Swordfish subroutines and functions are non re-entrant, that is, you cannot make recursive subroutine or functions calls.

Parameters
The compilers default parameter passing mechanism is by value or ByVal. Passing by value means that a local copy of the variable is created, and the subroutine or function operates on a copy. If your
…ver más…

For example, given the declaration sub MySub(byref pValue as word) end sub

then an error 'cannot be passed by reference' message is generated when any of the following calls are made,
MySub(10) MySub(Index * Index)

Remember, passing by reference forces the compiler to pass the RAM address of a variable, allowing it to be changed from within a subroutine or function. Constants or expressions do not have RAM addresses associated with them, and so cannot be used if a parameter argument is expecting pass by reference. If your subroutine or function parameter declaration is likely to be passed a constant or expression, then you must always pass by value. When a parameter is passed by value, it is sometimes useful to initialize the argument with a constant. For example, sub Print(pStr as string, pTerminator as string = #13 + #10) USART.Write(pStr, pTerminator) end sub

The formal parameter pTerminator has a default value of #13#10, which corresponds to a carriage return, line feed pair. If the subroutine Print() is called without a pTerminator argument value,
Print("Hello World")

then pTerminator will default to #13#10 when USART.Write() is called. If you wish to explicitly override the formal parameter default, then call your subroutine with the required value, like this
Print("Hello World", null)

Here, pTerminator is set to the null terminator when USART.Write() is called. It should be noted that you can only assign constants if the

Documentos relacionados

  • Ensayo Florence Nightingale
    1127 palabras | 5 páginas
  • Monografia de Florence Nightingale
    3770 palabras | 16 páginas
  • Etapas de enfermeria & florence nightingale
    797 palabras | 4 páginas
  • Etapas de enfermeria & florence nightingale
    803 palabras | 4 páginas
  • FLORENCE NIGHTINGALE RESUMEN DE LA PELICULA
    637 palabras | 3 páginas
  • Notas sobre enfermería. florence nightingale
    1843 palabras | 8 páginas
  • Florence nightingale notas sobre enfermeria resumen
    1480 palabras | 6 páginas
  • Teorías y modelos de enfermería: florence nightingale, virginia henderson y dorotea e. orem
    1179 palabras | 5 páginas
  • Teoria florence nightali
    10117 palabras | 41 páginas
  • Florencia n.
    1297 palabras | 6 páginas