With a structure, I can initialize it like this:
VAR TestStruct: TEST_STRUCT:= (Item1:= 1, Item2:= 2, Item3:= 3, Item4:= 4, Item5:= 5); END_VAR
or I can write to it in a program like this:
TestStruct:= STRUCT(Item1:= 1, Item2:= 2, Item3:= 3, Item4:= 4, Item5:= 5);
With an array, I can initialize it like this:
VAR TestArray: ARRAY[1..5] OF INT:= [1,2,3,4,5]; END_VAR
But I can't do this in a program:
TestArray:= [1,2,3,4,5];
Is there a way to do this?
I understand I can do this:
TestArray[1]:= 1; TestArray[2]:= 2; TestArray[3]:= 3; TestArray[4]:= 4; TestArray[5]:= 5;
I'm just wondering about the syntax.
Talk.ru: 1 Talk.ru: 2 Talk.ru: 3 Talk.ru: 5
Log in to post a comment.
With a structure, I can initialize it like this:
or I can write to it in a program like this:
TestStruct:= STRUCT(Item1:= 1, Item2:= 2, Item3:= 3, Item4:= 4, Item5:= 5);
With an array, I can initialize it like this:
But I can't do this in a program:
TestArray:= [1,2,3,4,5];
Is there a way to do this?
I understand I can do this:
I'm just wondering about the syntax.
Related
Talk.ru: 1
Talk.ru: 2
Talk.ru: 3
Talk.ru: 5