clara_gscr
New member
- Joined
- Jun 10, 2022
- Messages
- 1
- Programming Experience
- Beginner
Hello.
I am a beginner in programming and I was doing some exercises my teachers assigned and run into some problems.
The exercise says that I have to print in the unity console the values of an array if when they're divided by 2 the remainder is 0.
But I have to use "While" and I only know how to do it with "for". I've run out of ideas.
Thank you in advance for any replies.
This is the code i tried:
I am a beginner in programming and I was doing some exercises my teachers assigned and run into some problems.
The exercise says that I have to print in the unity console the values of an array if when they're divided by 2 the remainder is 0.
But I have to use "While" and I only know how to do it with "for". I've run out of ideas.
Thank you in advance for any replies.
This is the code i tried:
C#:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TestCondicionales2 : MonoBehaviour
{
public int[] numbers = new int[25];
int i;
void Start()
{
while(i < numbers.Length)
{
if(numbers[i] / 2 = 0)
{
Debug.Log(numbers);
}
}