Hello everyone,
I want to assign some default values to an array of integers with KAREL.
In C language, I can write like this "int_array [9] = [1,2,3,4,5,6,7,8,9]".
But I don't know how to do it with the KAREL language.
Can anyone help me?
I will be grateful for any help.
Assign value to an array with KAREL
-
lan1301 -
October 26, 2018 at 6:00 AM -
Thread is marked as Resolved.
-
-
-
Hi dha:
Thank you for your reply.
You can do something like this:Probably yes.
But if the values are not the same value, then...
I don't know how to do. -
-
Hi dha:
It should be that I did not make it clear.
This is what I want to do, as shown below.Code
Display MoreVAR array_i : ARRAY[30] OF INTEGER BEGIN array_i[1]=5 array_i[2]=6 array_i[3]=3 array_i[4]=8 array_i[5]=7 . . .
Line-by-line input is too much trouble.
Is there any other way of doing this?
Thank you very much for your reply. -
I understand.
I think it is only possible to set one array element per program line.
Why you need this? You can create routine which will set array elements ...
-
Hi dha:
I understand.I think it is only possible to set one array element per program line.
Why you need this? You can create routine which will set array elements ...
Because I need to combine AOI to pick and place.
So there will be 120 arrays that must be set to default values.
Thank you a lot.