Sir, range based for loop seems difficult to me. can I continue without using it, as I’m comfortable with the normal for loop and all the nesting stuff?
What do you find more difficult about it? It should be simpler, you’re just looping the entire contents of the array.
for (FString Word : WordList)
This says for every Word in WordList. Given this definition of WordList
TArray<FString> WordList{ TEXT("Jim"), TEXT("Bill"), TEXT("Bob") };
This code:
for (FString Word : WordList)
{
PrintLine(Word);
}
Would print
Jim
Bill
Bob
2 Likes
Hi,
Range based loop for you will be easier if you will use ‘auto’ specifier instead of different Types.
ex.:
for (auto &Word : WordList)
{
PrintLine(Word);
}
Using ‘auto’ telling your Unreal Engine and VS to check themselves what type is needed to put it to range Loop. Its really easy and you can use it nearly everywhere .
Hope I have helped