-
Notifications
You must be signed in to change notification settings - Fork 89
Basic Array Construction
NN--- edited this page Apr 11, 2012
·
7 revisions
- Category: Arrays, Hash Tables and Dictionaries
- Description: This sample demonstrates basic array construction.
- Code:
using System.Console;
def emptyArray1 = array(0) : array[long];
def emptyArray2 : array[int] = array(0);
def smallNums = array[1, 2, 3];
def notInitializedArray = array(5); // type inferred from usage
notInitializedArray[2] = 42;
WriteLine($"emptyArray1 = '..$emptyArray1'");
WriteLine($"emptyArray2 = '..$emptyArray2'");
WriteLine($"nsmallNums = '..$smallNums'");
WriteLine($"nnotInitializedArray = '..$notInitializedArray'");
- Execution Result:
emptyArray1 = ''
emptyArray2 = ''
nsmallNums = '1, 2, 3'
nnotInitializedArray = '0, 0, 42, 0, 0'
[Copyright ©](Terms of use, legal notice)