Skip to main content
Inspiring
June 27, 2008
Answered

Why do I use the the * operator here?

  • June 27, 2008
  • 2 replies
  • 276 views
Setting a 2d array:
<cfset my2darray[loopcount][loopcount2] = (loopcount * loopcount2)>

or a 3d array:
<cfset my3darray[loopcount][loopcount2][loopcount3] = (loopcount * loopcount2 *loopcount3)>

I don't understand why I need to use the * operator what is it doing? Thanks for any help on this one I am nearly there!!
This topic has been closed for replies.
Correct answer Newsgroup_User
Hydrowizard wrote:
>
> I don't understand why I need to use the * operator what is it doing? Thanks
> for any help on this one I am nearly there!!
>

I guess it is used there because for some reason one wants the value of
each element in the 3 dimensional array to be a value equal to the three
indexes multiplied together. What one would do with that, I can not
imagine, but that is what is going on.

P.S. Actually I presume this just a simple example so they are just
creating somewhat meaningful but ultimately random values. In a real
world application you would be setting the values to whatever the system
needs them to be.

2 replies

Inspiring
June 27, 2008
Yes Ian, it's an example from the mx docs, I just didn't get it.
Right on with the learning now! Thank-you as ever really appreciated
Newsgroup_UserCorrect answer
Inspiring
June 27, 2008
Hydrowizard wrote:
>
> I don't understand why I need to use the * operator what is it doing? Thanks
> for any help on this one I am nearly there!!
>

I guess it is used there because for some reason one wants the value of
each element in the 3 dimensional array to be a value equal to the three
indexes multiplied together. What one would do with that, I can not
imagine, but that is what is going on.

P.S. Actually I presume this just a simple example so they are just
creating somewhat meaningful but ultimately random values. In a real
world application you would be setting the values to whatever the system
needs them to be.