G
G
GmDvlpr2019-12-07 11:33:53
code review
GmDvlpr, 2019-12-07 11:33:53

Code review. What can be improved?

Well, is there a thread of spaghetti code here? I just don’t understand what I’m doing wrong, my code seems to work fine, I just wanted random numbers to be shown and erased, so to speak, practice. Just answer me pliz, is it bydlokod or not?

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] a = new int[99];
            Random ran = new Random() ;
            while(true){

                for (int i = 0; i < a.Length; i++)
                {
                    a[i] = ran.Next(0,99);
                    Console.WriteLine(a[i]);
                    System.Threading.Thread.Sleep(100);
                    Console.Clear();
                }
            }

            Console.ReadLine();
        }
    }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
GavriKos, 2019-12-07
@GmDvlpr

1) Why do you need an array of numbers at all?
2) Pause the main thread - so-so idea, IMHO
3) There is an infinite loop without any possibility to interrupt it.
4) A bunch of extra line breaks, left spaces, no spaces between parameters... In general, the codestyle is so-so.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question