Question about function call

Hello, I just finished the lesson, I noticed that the following line was used in the code :

HiddenWord = GetValidWords(Words)[FMath::RandRange(0,GetValidWords(Words).Num() - 1)];

When the GetValidWords is used inside the RandRange to get the .Num() values, it will be executed again ? In the background, Unreal will be going through all the list again just to return us the Total number of values ?
So If I’m right, shouldn’t be better to store the List on a Array so that we can reach out to the .Num() of the array instead of executing the whole function again ?
Or am I crazy :slight_smile: ?

Thank you for the attention !

The next lesson is literally the answer of this question … sorry :slight_smile:

2 Likes

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms