concepts/
efun/
NAME
	operators

DESCRIPTION

	These are the operators availailable in LPC. They are listed
	in the order of precedence (low priority first):


	expr1 , expr2	Evaluate 'expr1' and then 'expr2'. The
			returned value is the result of 'expr2'. The
			returned value of 'expr1' is thrown away.

	var = expr	Evaluate 'expr', and assign the value to
			'var'. The new value of 'var' is the result.

	var += expr	Assign the value of 'expr' + 'var' to 'var'.
			This is equivalente to "var = var + expr".

	var -= expr	Similar to '+=' above.
	var &= expr
	var |= expr
	var ^= expr
	var <<= expr
	var >>= expr
	var *= expr
	var %= expr
	var /= expr

        expr1 ? expr2 : expr3
                        Evaluates 'expr1' and branches according to
                        its truth value. If it is true, the 'expr2' is
                        evaluated and returned as result, else
                        'expr3'.

	expr1 || expr2	The result is true if 'expr1' or 'expr2' is
			true. 'expr2' is not evaluated if 'expr1' was
			true.

	expr1 && expr2	The result is true i 'expr1' and 'expr2' is
			true. 'expr2' is not evaluated if 'expr1' was
			false.

	expr1 | expr2	The result is the bitwise or of 'expr1' and
			'expr2'. 

	expr1 ^ expr2	The result is the bitwise xor of 'expr1' and
			'expr2'. 

	expr1 & expr2	The result is the bitwise and of 'expr1' and
			'expr2'.
                        For arrays, the intersection set is computed.

	expr1 == expr2	Compare values. Valid for strings and numbers.

	expr1 != expr1	Compare values. Valid for strings and numbers.

	expr1 > expr2	Valid for strings and numbers.

	expr1 >= expr2	Valid for strings and numbers.

	expr1 < expr2	Valid for strings and numbers.

	expr1 <= expr2	Valid for strings and numbers.

	expr1 << expr2	Shift 'expr1' left by 'expr2' bits.

	expr1 >> expr2	Shift 'expr1' right by 'expr2' bits.

	expr1 + expr2	Add 'expr1' and 'expr2'. If numbers, then
			arithmetic addition is used. If one of the
			expressions are a string, then that string is
			concatenated with the other value.
			Arrays/mappings can be added to other
			arrays/mappings.

	expr1 - expr2	Subtract 'expr2' from 'expr1'. Valid for
			numbers, strings, arrays, mappings.
			For arrays and mappings, all occurences of the
			elements in 'expr2' are removed from 'expr1',
			and the result is returned.

	expr1 * expr2	Multiply 'expr1' with 'expr2'.

	expr1 % expr2	The modulo operator of numeric arguments.

	expr1 / expr2	Integer division.

	++ var		Increment the value of variable 'var', and
			return the new value.

	-- var		Decrement the value of variable 'var', and
			return the new value.

	- var		Compute the negative value of 'var'.

	! var		Compute the logical 'not' of an integer.

	~ var		The boolean 'not' of an integer.

	var ++		Increment the value of variable 'var', and
			return the old value.

	var --		Decrement the value of variable 'var', and
			return the old value.

	expr1[expr2]	The array or mapping given by 'expr1' is
			indexed by 'expr2'. 

	expr1[expr2..expr3] The symbolic form of extract(). Extracts a
			piece from an array or string. expr2 or expr3
			may be omitted, default is start resp. end of
			expr1. Negative numbers for expr2 or expr3
			mean ``count from before the beginning'', i.e.
			foo[-2..-1] is an empty array or string.
			foo[<2..<1] gives the 2nd and last element of
			the array resp. chars of the string.

	expr1->name(...) The symbolic form of call_other(). 'expr1'
			gives either an object or a string which is
			used as the file_name of an object, and calls
			the function 'name' in this object.

        ident::name(...)
			Call the inherited function 'name' with the
			given parameters in the parent 'ident'.
			'ident' may be given as string containing the
			full pathname, or as identifier containing the
			pure basename.
			If 'ident' is omitted, the last inherited
			function of this 'name' is called.

	({ })		Array constructor.
	([ ])		Mapping constructor.

NOTE
	The closure operators are not described here.

SEE ALSO
	arrays(LPC), alists(LPC), mappings(LPC), closures(LPC)