Guest User

jizz, jizz everywhere.

a guest
Mar 11th, 2013
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 1.18 KB | None | 0 0
  1. Private _r As Integer = Nothing
  2.     Private _r1 As Integer = Nothing
  3.     Private Function calcBets(ByVal stake As Integer, ByVal ParamArray odds() As Integer)
  4.         Dim r As Integer = 1
  5.         _r = stake * (1 + odds(0)) ' We won't need to use the "stake" variable any other time, so we calculate that with the first odd first.
  6.         val = _r ' Set the "val" property to the outcome of the calculations.
  7.         Do While r <> UBound(odds) + 1 ' Do While "r" does not equal the amount of arguments supplied from the integer array of "odds".
  8.             _r1 = val * (1 + odds(r)) ' Multiply the stored value of our first operation by the second operation.
  9.             val = _r1 ' Set the value of "val" to our second operations outcome, this will continue in the loop indefinitely.
  10.             r += 1 ' Increment the value of "r" so that we can continue "up" our array.
  11.         Loop
  12.         Return val ' Once the loop is done, return the final value.
  13.     End Function
  14.  
  15.     Private _val As Integer = Nothing
  16.     Private Property val As Integer
  17.         Get
  18.             Return _val
  19.         End Get
  20.         Set(value As Integer)
  21.             _val = value
  22.         End Set
  23.     End Property
Advertisement
Add Comment
Please, Sign In to add comment