CPolynomial:Exists


The Exists method returns true if a coefficient has been initialized at a given index.

Syntax

bSuccess = CPolynomial:Exists( index )

bullet.gif    index is the index of the coefficient to test.

bullet.gif    If initialized, this method returns true.

bullet.gif    If not initialized, false is returned.

Remarks

If you use Init then the first n coefficient values are set and this function will return true if tested with index in range. Otherwise, the coefficient values are not initialized if you do not Set them or if you Remove them.

Example

The following script tests whether the coefficient at index [3] has been initialized:

P = new_polynomial()

-- create a CPolynomial

P:Set( 4, 0.112)

-- set coef[4]

P:Set( 1, 5.5)

-- set coef[1]

if P:Exists(3) then

-- has coef[3] been set?

  s = "yes" else s = "no"

 

end

 

Printf("coef[3] exists= %s", s)

-- result: coef[3] exists= no

Related Topics

CPolynomial, Count


Mira Pro x64 Script User's Guide, Copyright Ⓒ 2023 Mirametrics, Inc. All Rights Reserved.