1

Had to change this up. I have two arrays and I want to essentially concatenate them into one array.

 completearray:= completearray, temparray."concatenate the new array to the existing one"

How do I get this working please? Thanks.

Kobojunkie
  • 6,375
  • 31
  • 109
  • 164

4 Answers4

8

Your code works in Squeak, so what is the problem?

anArray := #(1 2 3 4).
anotherArray := #(5 6 7).
anArray, anotherArray "Returns #(1 2 3 4 5 6 7)"
Sean DeNigris
  • 6,306
  • 1
  • 31
  • 37
1

if your code doesn't run, you probably don't have an Array object in "completearray", but instead have an object that doesn't respond to #, (i.e. nil doesn't respond to #,).

Karsten
  • 2,772
  • 17
  • 22
0

I don't know, why it may not work in your version of VisualWorks, but you can try to do this:

completearray addAll: temparray.

Source, just in case:

addAll: collection
    ^ collection
        do: [ :element | self add: element];
        yourself
Mekanik
  • 2,532
  • 1
  • 22
  • 20
0

you are adding a character ($,), but you have to add a string with #, (cancat). try: yourString , ','