Advertisement
karlakmkj

Building Arrays

Nov 19th, 2020
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.51 KB | None | 0 0
  1. using System;
  2.  
  3. namespace BuildingArrays
  4. {
  5.   class Program
  6.   {
  7.     static void Main(string[] args)
  8.     {
  9.       //to define an array and then initialize it later - use new keyword
  10.       string[] summerStrut;  
  11.       summerStrut = new string[] {"Juice", "Missing U", "Raspberry Beret", "New York Groove", "Make Me Feel", "Rebel Rebel", "Despacito", "Los Angeles"};
  12.  
  13.       //To declare and initialize at the same time - no need to use new keyword
  14.       int[] ratings = {2, 2, 5, 1, 3, 2, 4, 3};
  15.  
  16.     }
  17.   }
  18. }
  19.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement