Results 1 to 3 of 3

Thread: [RESOLVED] Error with Array or Function?

Threaded View

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2007
    Location
    Riverton, WY
    Posts
    36

    Resolved [RESOLVED] Error with Array or Function?

    The yellow part is the Fuction declaration...

    The following code has an error in it.

    VB Code:
    1. Function diceRoller(ByVal fstNum As Long, ByVal sndNum As Long) As String
    2.    
    3.     Dim rdmRolls() As Integer, i As Integer, rollResults As Integer, AmIFirst As Boolean
    4.     i = 0
    5.     rollResults = 0
    6.     rdmRolls (fstNum - 1)
    7.     AmIFirst = True
    8.    
    9.     Do While i < fstNum
    10.         rdmRolls(i) = Int(6 * Rnd + 1)
    11.         If rdmRolls(i) >= 5 Then rollResults = rollResults + 1
    12.        
    13.         If AmIFirst = True Then
    14.             diceRoller = diceRoller & " " & CStr(rdmRolls(i))
    15.         Else
    16.             diceRoller = diceRoller & ", " & CStr(rdmRolls(i))
    17.         End If
    18.    
    19.         i = i + 1
    20.     Loop
    21.    
    22.     diceRoller = diceRoller & ": With a final result of " & CStr(rollResults) & " successes."
    23. End Function

    The error is "Compile error: Expected Sub, Function, or Property"
    Last edited by CyberInfantry; Jan 23rd, 2007 at 03:34 PM. Reason: Correcting title

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