Results 1 to 2 of 2

Thread: Function Procedure

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Feb 2000
    Location
    USA
    Posts
    27

    Unhappy

    I don't understand the purpose of a Function Procedure, is it neccessary and when?

    I was doing some example from a book and it spoke about doing function procedures here is my code with out the FP
    It says to do a function procedure for the Pay Rate but I don't what the purpose is..If so How could I do one...any help appreciated in advance, thank you

    Const cFIFTYFIVE As Currency = 0.55
    Const cFIFTY As Currency = 0.5
    Const cSIXTY As Currency = 0.6
    Const cSIXTYFIVE As Currency = 0.65
    Dim iPiece As Integer
    Dim stName As String


    If stName = Empty Then
    MsgBox "no message", vbInformation
    End If
    If IsNumeric(txtPieces.Text) Then
    iPiece = Val(txtPieces.Text)
    miCounter = miCounter + 1
    If iPiece <= 199 Then
    mcTotal = iPiece * cFIFTY
    ElseIf iPiece <= 399 Then
    mcTotal = iPiece * cFIFTYFIVE
    ElseIf iPiece <= 599 Then
    mcTotal = iPiece * cSIXTY
    ElseIf iPiece >= 600 Then
    mcTotal = iPiece * cSIXTYFIVE
    End If
    Else
    MsgBox "Please enter a Numeric value in Piece", vbInformation, "No Piece Number"

    End If

  2. #2
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    A Function procedure returns a value
    Declare your functions like this: with arguments separeted with "," between the ()
    Code:
    Function Double(value as integer) as integer
     Double=value*2
    End function
    Then you can call it like this
    [code]
    Dim a%
    a=double(5)
    msgbox a 'shows 10
    [code]
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width