Top index Wirbel home

::add

set(T).add(T) - insert an item into a set
list(A).add(A) - append element to list
string.add(string) - append string to string
string.add(char) - append char to string

set(T).add(T) inserts an item of type T into a set of type set(T). If an equal (but not neccessary identical item) is already contained in the set then nothing happens (the existing item is not replaced with the new one). The set is changed, but for conveniance it is returned by the method. This allows you to construct chains like that in the example below.

list(A).add(A) appends an element at the end of a list. This does the same as append in Python, but we decided to use add for lists, sets, strings und dicts. This function returns the list itself after appending. This makes it possible to append more than one element in an expression:

 a.add(15).add(17).add(19)

string.add(string) appends another string at the back of the string. This alters the string object. Use + for concatenating strings without alteration.

string.add(char) appends a single character at the back of a string. This alters the string object.

Examples

{1,3}.add(2).add(3) == {1,2,3}