IS 51 extra credit quiz

IS 51 extra credit quiz - Why use procedure? Decomposition...

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

View Full Document Right Arrow Icon
Why use procedure? Decomposition o Break problems into smaller ones Avoid repeating codes Software reusability Easier maintenance debugging and testing What are procedures? Small modules that define specific task that may be used at many points in a program Code containers used to store a code Two types of procedures o Subroutine o Function To use subs or functions, need to know how to: o Define/declare o Pass arguments o Return the results to their calculations Subroutine Sub SubroutineName (parameter list) Statements End Sub Defined using sub statement The sub statement of a header and a body The header consist of the sub name and parameter list in parentheses The naming of sub follows the same rules as variables Use call to call subroutine to make code more readable
Background image of page 1

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

View Full DocumentRight Arrow Icon
Sub Procedure example Sub main () Dim x, y as integer X = cint (InputBox (“Enter a number”) Y=cint (InputBox (“Enter a second number”) Call sum (x, y) End sub
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 04/20/2008 for the course IS 51 taught by Professor Jung during the Spring '07 term at CSU Fresno.

Page1 / 4

IS 51 extra credit quiz - Why use procedure? Decomposition...

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