Certain code keeps crashing my UE

Just wondering why this code crashed my UE if i delete it it works fine but if i press play with this in my code it freezes

int32 i = 0;

    while (i < 2)

    {

        PrintLine(TEXT("%i"), i);

    }

    for (int32 Index = 0; Index < 2; Index++)

    {

        PrintLine(TEXT("%1"), Index);

    }

    int32 j = 0;

    do

    {

        PrintLine(TEXT("%1"), j);

        j++;

    } while (j < 2);

The first while loop never exits because i is always less than 2 so keeps spinning add i++; in that loop like you have with the do loop and it will exit once I gets to 2

ahhh yes thats is, it works fine now i also changes the %1’s i had to i%

All done it :slight_smile: also the classic l and 1 looking the same is another.

you can legitimately use while == true closed loops just need to be very careful and deliberate, its quite fun to write a simple class that opens a port to listen on in one process and keep that open with while true then you can connect to it with another process and send stuff between the 2.

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

Privacy & Terms