Help with loop and if statement code

while (end=0)
{
if (a<=4)
{
a++;
}
if (here = 1)
{
a = 1;
}
if (here = 2)
{
a = 2;
}
if (here = 3)
{
a = 3;
a = 4;
a = 5;
}
}

using this loop, how do i make the here = 3 if statement keep looping round? like a = 3, a = 4, a = 5, a = 3, a = 4, a = 5.
i know this code will probably crash but this is an example for my larger code so i just need to know how to do this
Recall that = is assignment, == is comparison. Check all of your conditionals.
1. If you don't change end inside the loop, how will it exit?
2. = isn't the same as ==. Condition usually use the latter.
3. You could create another loop such as:

1
2
3
4
for (a = 3; here == 3; a++) {
	if (a > 5)
		a = 3;
}

but this is really weird and you could probably write your program differently.
in main code the == are sorted out and i would if i could guys xD, i didnt think a loop works inside another loop
Well, it does. Loops can be nested.
Topic archived. No new replies allowed.