using UnityEngine; public class While2 : MonoBehaviour { public int num; int som; // Start is called once before the first execution of Update after the MonoBehaviour is created void Start() { int i=0; while (i<=num) { som=som+i; print(som); i++; } } // Update is called once per frame void Update() { } }