17 lines
293 B
Mathematica
17 lines
293 B
Mathematica
>> list = {'a','b','c','d','e','c','f','c'};
|
|
>> searchCollection(list,'c','first')
|
|
|
|
ans =
|
|
|
|
3
|
|
|
|
>> searchCollection(list,'c','last')
|
|
|
|
ans =
|
|
|
|
8
|
|
|
|
>> searchCollection(list,'g','last')
|
|
??? Error using ==> searchCollection at 11
|
|
The string 'g' does not exist in this collection of strings.
|