NeturalMath Language Definition and Syntax

And Operator (&)

The And Operator compares two values and yields the result. If the values are boolean in nature, it will perform a boolean AND operation. If the values are numeric, the resulting data will be an AND comparison of the bits.

Syntax

value + value

Data Types

Bool

Logic Table
right
left false true
false false false
true false true

The Boolean And operation returns true only if both operands are true. If not, it will return false. This has the same net result as the Multiply Operator for bools.
:> print true & true

true
:> print true & false

false
:> print false & false

false
:> print false & true

false

Complex

This section is not implemented

Number

Numbers evaluated and a bitwise AND comparison is returned. This has the effect of comparing the bits and returning a new value based on where the bits are identical.
:> print 10 & 2

2
:> print 1234 & 3

2

Range

This section is not implemented

Set

This section is not implemented

String

The and operator will evaluate the characters in comment with both strings and return a new string containing only the characters which appear in both strings. Characters will appear in the order they appear in the first string. This has the effect of removing any characters or sequences which are not present in both strings. If the strings are identical, the same string will be returned. If a character appears more than one time in both strings, it will appear the number of times there is a match.
:> print 'Netural' & 'Math'

'ta'
:> print 'Microsoft' & 'Google'

'oo'

Unit

This section is not implemented

See Also

Data Types
Arithmatic Operators

Last edited Oct 20, 2010 at 1:12 PM by zanethorn, version 3

Comments

No comments yet.