[RESOLVED] Error with Array or Function?
The yellow part is the Fuction declaration...
The following code has an error in it.
VB Code:
Function diceRoller(ByVal fstNum As Long, ByVal sndNum As Long) As String
Dim rdmRolls() As Integer, i As Integer, rollResults As Integer, AmIFirst As Boolean
i = 0
rollResults = 0
rdmRolls (fstNum - 1)
AmIFirst = True
Do While i < fstNum
rdmRolls(i) = Int(6 * Rnd + 1)
If rdmRolls(i) >= 5 Then rollResults = rollResults + 1
If AmIFirst = True Then
diceRoller = diceRoller & " " & CStr(rdmRolls(i))
Else
diceRoller = diceRoller & ", " & CStr(rdmRolls(i))
End If
i = i + 1
Loop
diceRoller = diceRoller & ": With a final result of " & CStr(rollResults) & " successes."
End Function
The error is "Compile error: Expected Sub, Function, or Property"
Re: From with Array or Function?
This
Maybe it should be
VB Code:
Redim rdmRolls (fstNum - 1)
Re: From with Array or Function?
That fixed it perfectly! :D
Thank you!