Lecture 15 - Functions and Subroutines

Lecture 15 - Functions and Subroutines - 3/8/2010 Functions...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
3/8/2010 1 Functions and Subroutines How will learning this help me? • Functions built into your programs enable you to tailor programs to your needs. • Subroutines are mini- programs within larger programs—they enable you to keep complex parts of your program separate from other parts. Engr 160 Functions • A programmer defined function that returns a value when used in a main program Function Log10(ByVal z As Double) Log10=Log(z)/Log(10) End Function • General Form Function Name ( ByVal z As Single ) – The name of the function follows the word Function – The “arguments” are in the parenthesis ByVal: by value, a numerical value is passed into the function Z As Single (or Double or Integer or String) Engr 160
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
3/8/2010 2 Functions ByRef Function Name ( ByRef z As Single ) ByRef: z will be changed in the function and may be a different value coming out of the function than was passed in Engr 160 Function Checklist 1. Does your function begin after the main program?
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/09/2012 for the course ENGR 160 taught by Professor Sengupta during the Spring '07 term at Iowa State.

Page1 / 8

Lecture 15 - Functions and Subroutines - 3/8/2010 Functions...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online