Most times when I use x in f(x) I don't want to change x, that could mess things up badly!
Here's how variable changing may be misused with a sub
With function it's clear x wont get messed up:
Here's how variable changing may be misused with a sub
Code: (Select All)
For x = 1 To 10
f x
Print x
Next
Sub f (x)
x = x ^ 2
End Sub
With function it's clear x wont get messed up:
Code: (Select All)
For x = 1 To 10
Print f(x)
Next
Function f (x)
f = x ^ 2
End Function
b = b + ...