HyperMath

Comparison

Comparison

Previous topic Next topic No expanding text in this topic  

Comparison

Previous topic Next topic JavaScript is required for expanding text JavaScript is required for the print function  

Two strings can be compared for an exact match (including case) using the double equal to operator (==).  The result is a if they match

> print("ABC" == "abc")

false

 

> print("ABC" == "ABC")

True

 

The comparison can be used in control structures such as shown below:

>str1 = "ABC"

> if (str1 == "abc") {

>        print("Strings are identical")

> }else {

>        print("Strings are not identical")

>}

 

      Strings are not identical.