Hello, how can I realise such code in blueprint scripting?
for (int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
//code sets x value
if (x)
i--;
}
}
Hello, how can I realise such code in blueprint scripting?
for (int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
//code sets x value
if (x)
i--;
}
}
Yes, you will just need to build a for loop yourself, with an index etc. instead of using the given for loop.
I’m kinda new in such sort of programming, could you please show me an example (screenshot of function)?
if you want to edit the condition of a loop from within the loop, you should probably use a While loop. for loops are best used for actions that are repeated a specific number of times.
if you want to see how a for loop works, double click on the for loop blueprint node, it should take you to the macro’s graph, which you can use as an example to make your own loop macro.
but be careful, editing the index during a loop can lead to infinite loops.