Question by
halodeltaapex · Jun 05, 2020 at 09:26 AM ·
scripting problemscripting beginnerscriptingbasicsloops
My loop isn't working and I don't know why.,My loops arent working.
two errors in my short collection of practice loops
(23,25): error CS0029: Cannot implicitly convert type 'int' to 'bool'
(23,31): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
Here's the entire thing:
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class LoopsChallenge : MonoBehaviour { int num = -5; int j = 10; int k = 1; // Start is called before the first frame update void Start() { while (num <= 5) { print(num);
num += 1;
}
for(int i = -5; i ++; i <= 5)
{
print(i);
}
while (j <= 50)
{
print(j);
j += 2;
}
while(k <= 100) {
if (k % 5 == 0 && k % 3 == 0)
{
print(k);
}
k += 1;
}
}
// Update is called once per frame
void Update()
{
}
}
Comment