Hello,
is such code allowed:
--------------------------------------------------------------------
list < string > words = [ "Jane", "John" ];
integer index = -1;
foreach( string word,
words,
{ index = index + 1;
words[index] = "Hello " + word;
}
);
--------------------------------------------------------------------
Is in any case the result words == [ "Hello Jane", "Hello John" ] ?
If the above is allowed, what about even more evil looking code:
--------------------------------------------------------------------
list < string > words = [ "Jane", "John", "Joe" ];
integer index = -1;
foreach( string word,
words,
{ index = index + 1;
if( "John" == word )
{ remove( words, index );
}
}
);
--------------------------------------------------------------------
Is in any case the result words == [ "Jane", "Joe" ] ?
If it is not allowed, how to copy a list?
Does
--------------------------------------------------------------------
list < string > words = [ "Jane", "John", "Joe" ];
list < string > copy = words;
--------------------------------------------------------------------
result two totally separated lists words and copy
or does copy contain only a reference which points to words
so that
--------------------------------------------------------------------
remove( copy, 1 );
--------------------------------------------------------------------
would actually result copy == words == [ "Jane", "Joe" ] ?
Kind Regards
Johannes Meixner
--
SUSE LINUX Products GmbH, Maxfeldstrasse 5, 90409 Nuernberg, Germany
AG Nuernberg, HRB 16746, GF: Markus Rex
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]