+ 1
how to write on console the elements of an array? C#
hello, how do i enter the elements of an array from the console? for example: i have an array called palette[] and I want it to have x elements, in this case, 5 elements: yellow, blue, green, orange and purple. how can i do this? thank you :^) (i’m sorry for my bad English. English is not my first language)
2 ответов
+ 1
Thanks jool.
Your english is good enough to be understandable.
Have a look at this sample code
https://code.sololearn.com/c4puOpsZsMpJ/?ref=app
+ 1
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SoloLearn
{
class Program
{
static void Main(string[] args)
{
string[] palette = {"yellow", "blue", "green", "orange", "purple"};
foreach (string name in palette)
Console.WriteLine(name);
}
}
}