3.44 same? : Same comparison operator

Format

$obj$.same?($zdd$) $\rightarrow $ $bool$ $\rightarrow $ $bool$

$obj$ === $zdd$ $\rightarrow $ $bool$

Description

Compare 2 ZDD objects $obj$ and $zdd$, returns true if the operands are the same, and false if they are different.

Two "=" operator (== operator) has a different definition, it is used to carry out equal to comparison of the terms within the expression, thus, take note that this operator is completely different.

Example

Example 1: Basic Example

> require 'zdd'
> require 'zdd'
> a=ZDD::itemset("a")
> b=ZDD::itemset("b")
> c=ZDD::itemset("c")
> puts a.same?(b)
false
> puts a.same?(a)
true
> puts (a+b).same?(a+c)
false
> puts (a+b).same?(a+b)
true
> puts (a-a).same?(0)
true
> puts (2*a/a)===2
true

See Also

diff? : Not equal to comparison operator