1 / 10

Functions

Functions. CE 311 K - Introduction to Computer Methods Daene C. McKinney. Introduction. Functions Named Constants Structured Programming. Functions. A block of statements (with a name) located between Function and End Function statements

katy
Download Presentation

Functions

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Functions CE 311 K - Introduction to Computer Methods Daene C. McKinney

  2. Introduction • Functions • Named Constants • Structured Programming

  3. Functions • A block of statements (with a name) located between Function and EndFunction statements • Executed (called) when name appears in a program along with arguments • Program: • … • var = Name( Argument list ) • End Program Program • Function Name( Arguments ) As Type • … statements • … • Return expression • End Function Function

  4. Example – FtoC Call Function Return Value

  5. Example – Bank Account

  6. Example – Bank Account

  7. Named Constants • We often need to use constants, like PI in our computations. Const Constant_Name As Data_Type = value • Example: Const PI As Double = 3.14159

  8. no yes no yes Structured Programming • Sequence • Selection • Repetition

  9. Structured Programming Start Input Subprogram Get Some Input Calculation Subprogram Make Some Calculations Output Subprogram Print Some Output Stop

  10. Summary • Functions • Named Constants • Structured Programming

More Related