Array Sample
' These are samples for Array object and arrays.
' To set value to array
shape["shape"] = "Rectangle" ' set value
shape["color"] = "Lime" ' set value
TextWindow.WriteLine(shape) ' shape=Rectangle;color=Lime;
' To get value from array
shape["color"] = "Lime" ' set value
color = shape["color"] ' get value
TextWindow.WriteLine(color) ' Lime
' To remove value from array
shape["shape"] = "Rectangle" ' set value
shape["color"] = "Lime" ' set value
shape["color"] = "" ' remove value
TextWindow.WriteLine(shape) ' shape=Rectangle;
' ContainsIndex operation
param["x"] = 200
param["y"] = 100
If Array.ContainsIndex(param, "x") Then
TextWindow.WriteLine(param["x"]) ' 200
EndIf
' ContainsValue operation
param["x"] = 200
param["y"] = 100
If Array.ContainsValue(param, 100) Then
TextWindow.WriteLine("Array param has value 100.") ' True
EndIf
' GetAllIndices operation
param["x"] = 200
param["y"] = 100
index = Array.GetAllIndices(param)
TextWindow.WriteLine(index) ' 1=x;2=y;
' GetItemCount operation
param = "x=200;y=100;width=300;height=150;"
num = Array.GetItemCount(param)
TextWindow.WriteLine("Array param has " + num + " items.") ' 4
' IsArray operation
param = "x=200;y=100;width=300;height=150;"
If Array.IsArray(param) Then
TextWindow.WriteLine("Array param is an array.") ' True
EndIf
' To set value to array
shape["shape"] = "Rectangle" ' set value
shape["color"] = "Lime" ' set value
TextWindow.WriteLine(shape) ' shape=Rectangle;color=Lime;
' To get value from array
shape["color"] = "Lime" ' set value
color = shape["color"] ' get value
TextWindow.WriteLine(color) ' Lime
' To remove value from array
shape["shape"] = "Rectangle" ' set value
shape["color"] = "Lime" ' set value
shape["color"] = "" ' remove value
TextWindow.WriteLine(shape) ' shape=Rectangle;
' ContainsIndex operation
param["x"] = 200
param["y"] = 100
If Array.ContainsIndex(param, "x") Then
TextWindow.WriteLine(param["x"]) ' 200
EndIf
' ContainsValue operation
param["x"] = 200
param["y"] = 100
If Array.ContainsValue(param, 100) Then
TextWindow.WriteLine("Array param has value 100.") ' True
EndIf
' GetAllIndices operation
param["x"] = 200
param["y"] = 100
index = Array.GetAllIndices(param)
TextWindow.WriteLine(index) ' 1=x;2=y;
' GetItemCount operation
param = "x=200;y=100;width=300;height=150;"
num = Array.GetItemCount(param)
TextWindow.WriteLine("Array param has " + num + " items.") ' 4
' IsArray operation
param = "x=200;y=100;width=300;height=150;"
If Array.IsArray(param) Then
TextWindow.WriteLine("Array param is an array.") ' True
EndIf
Comments
Post a Comment