U unba1300 Guest Apr 1, 2012 #1 This is a simple example of something I'd like to do in order to assign values to variables within a loop. But I can't seem to figure out how to merge varFood & iLoop together to make varFood1, varFood2, etc. Code: Copy Dim iLoop As Int For iLoop = 1 To 5 varFood & iLoop = 'pick a food at random from a list. Next iLoop Is this possible, or should I use an array? Thanks.
This is a simple example of something I'd like to do in order to assign values to variables within a loop. But I can't seem to figure out how to merge varFood & iLoop together to make varFood1, varFood2, etc. Code: Copy Dim iLoop As Int For iLoop = 1 To 5 varFood & iLoop = 'pick a food at random from a list. Next iLoop Is this possible, or should I use an array? Thanks.
M Mahares Expert Licensed User Longtime User Apr 1, 2012 #2 Code: Copy Dim varfood(5) As Int that will allow you to call your variables: varfood(0), varfood(1), varfood(2), varfood(3), varfood(4) Forgive me if I misunderstood the question. Mahares Upvote 0
Code: Copy Dim varfood(5) As Int that will allow you to call your variables: varfood(0), varfood(1), varfood(2), varfood(3), varfood(4) Forgive me if I misunderstood the question. Mahares
J Jost aus Soest Active Member Licensed User Longtime User Apr 1, 2012 #3 Exactly therefor Von Neumann gave us arrays! Upvote 0