Quantcast
Channel: Questions in topic: "loops"
Viewing all articles
Browse latest Browse all 184

My loop isn't working and I don't know why.,My loops arent working.

$
0
0
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() { } }

Viewing all articles
Browse latest Browse all 184

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>