Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Why do I use the the * operator here?

Participant ,
Jun 27, 2008 Jun 27, 2008
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!!
TOPICS
Getting started
230
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Jun 27, 2008 Jun 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 mean...
Translate
LEGEND ,
Jun 27, 2008 Jun 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 27, 2008 Jun 27, 2008
LATEST
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
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources