I know this might be SOOOO simplebut I've noticed that there are a few newbies here so this is to everyone especially the newbies:
Code:'It's right that to do this simple thign you would: Private Sub Command1_Click() Dim a As Integer Dim b As Integer Dim c As Integer Dim d As Integer Dim e As Integer Dim x As Integer Dim y As Integer Dim z As Integer a = 1 b = a + 4 c = b + a d = a - b e = b - c + a x = a + b + c + d + e y = a + b - c + d - e * x z = 0 MsgBox a & b & c & d & e & x & y & z & vbNewLine & "These are integers!" End Sub 'Instead you would do this: Private Sub Command1_Click() Dim a, b, c, d, e, x, y, z As Integer a = 1 b = a + 4 c = b + a d = a - b e = b - c + a x = a + b + c + d + e y = a + b - c + d - e * x z = 0 MsgBox a & b & c & d & e & x & y & z & vbNewLine & "These are integers!" End Sub 'Yes this is "better" but the thing is that a,b,c,d,e,x,y 'would be variables that can incdlude Nodes, Integers, 'Strings etc. but only z will be an integer. 'Now you will do this: Private Sub Command1_Click() Dim a As Integer, b As Integer, c As Integer, d As Integer, e As Integer, x As Integer, y As Integer, z As Integer a = 1 b = a + 4 c = b + a d = a - b e = b - c + a x = a + b + c + d + e y = a + b - c + d - e * x z = 0 MsgBox a & b & c & d & e & x & y & z & vbNewLine & "These are integers!" End Sub 'This is the exact code like the first one! 'Try this: Private Sub Command1_Click() Dim A(1 To 8) As Integer A(1) = 1 A(2) = A(1) + 4 A(3) = A(2) + A(1) A(4) = A(1) - A(2) A(5) = A(2) - A(3) + A(1) A(6) = A(1) + A(2) + A(3) + A(4) + A(5) A(7) = A(1) + A(2) - A(3) + A(4) - A(5) * A(6) A(8) = 0 MsgBox A(1) & A(2) & A(3) & A(4) & A(5) & A(6) & A(7) & A(8) & vbNewLine & "These are integers!" End Sub 'This stores all the integers in one! It takes like half of the best code of the above! 'I think this post should be an article!




but I've noticed that there are a few newbies here so this is to everyone especially the newbies:
Reply With Quote