Question about nested containers in Developer Help
|
|
I know you can have objects that contain other objects inside of objects, but how can I pull the contents of the container inside the main container? I want to calculate the weight of the contents of a nested container but I'm not sure how to even call the contents of a nested container...
|
As to your question: Calculating the weight of something and all of its contents is a recursive function. Looks something like this:
- Get my weight
- Get the weight of all my contents
- Return that
The part you're getting stuck on is 'get the weight of all my contents', but that's really just the same as the outer function. In code, it'd look something like this:
You might want to look up the . var to understand that code.