#a[(a=b)[3]]
1 messages · Page 1 of 1 (latest)
<@&987246399047479336> please have a look, thanks.
While you are waiting for getting help, here are some tips to improve your experience:
If your code is long, or you have multiple files to share, consider posting it on sites like https://pastebin.com/ and share the link instead, that is easier to browse for helpers.
If nobody is calling back, that usually means that your question was not well asked and hence nobody feels confident enough answering. Try to use your time to elaborate, provide details, context, more code, examples and maybe some screenshots. With enough info, someone knows the answer for sure.
Don't forget to close your thread using the command </help-thread close:1027500463647621170> when your question has been answered, thanks.
I understand that array a is fully evaluated, so then a is assigned the value of B, but does that mean this assignment disappears completely and has no effect on the rest of the code ?
Am I understanding it correctly that in essence it's this?: a[(a=b)[3]]?
I'm kinda reading it as a[b[3]], but no clue if that's right
a = b will assign b to a, but also return b to the caller
so it makes a = b and then uses that
obviously u should never write such terrible code lol
This is for the 1Z0-808 exam, they always use code like this to confuse us for the exam lol
This is what I was also thinking, but apparently the answer is a[3] which is 1, so I assume (a=b) is just assigned and then basically removed from there. This is the only thing that makes sense to me lol
How do you get to a[3] = 1? a[b[3]], b[3] = 0 -> a[0] = 1
Never mind I think I just got it
( a [ (a=b)[3]] )
So a is first stored which is: {1, 2, 3, 4)
It then assigns B to A which is {2, 3, 1, 0}
There it grabs index 3 which is 0
Then uses that as an index to search up from the already stored array in a
a[0] = 1
@quartz rampart This is correct, right ?
I believe so, yea. The re-assignment appears to be completely useless
Indeed, these exam questions are so confusing it's unreal 
I believe it first accesses 'a' and the assigns b to a and takes the value of b[3] and then a[0]
and if you print the value of a[0] it will diplay 2 since a is actually b now
so it does get assigned but is not relevant in that particular statement
In the exam they might have wanted to show off that an array stays the same even when assigned to something else while being accessed
possibly. I guess they just wanted to show how arrays are accessed when the same array is assigned to some other array at the same time
