Good Place. Good Things. Good Time.

Prolog not equal

Prolog not equal

Introduction to Prolog not equal

Prolog not equal is an operator to compare the two values and operand using a programming language. It is a function of the arithmetic operation using a high-level programming language. The prolog not equal is operators to determine two values are not the same or unmatchable. It is an arithmetic operator to find the inverse of the equality function in the programming language.

It is a combination of the arithmetic and comparison operator to compare to variables or values. It compares two values that are not similar for the arithmetic operation using a high-level language. The language uses an operator for negation or determines two values are not equal. It is Boolean operator finds whether given two values are equal or not.

Syntax of Prolog not equal

The prolog language uses logical operation for the “not equal” operation.  The prolog, not equal operator syntax is shown below.

Value1 == Value2.

Explanation:

  • The “==” sign is used to determine not equal values.
  • This operator is mostly used for numerical values and arithmetic operations.

The prolog language uses another operator for the “not equal” operation.

The “not equal” operator’s syntax is shown below.

Term1 == Term2.

Explanation:

  • The “==” sign is used to determine not equal terms.
  • This operator is mostly used for numerical and character values.
  • This function uses the terms of the prolog file.

The language uses an operator with terms for the “not equal” operation.

The “not equal” operator’s syntax is shown below.

Term1 = Term2.

Explanation:

  • The “==” sign is used to determine not equal terms.
  • This operator is mostly used for numerical and character values.
  • This function uses the terms of the prolog file.

How not equal Operator works in Prolog?

Prolog comment works in the “pl” file.

  • Create a file with the “pl” extension.

Example: main. pl

  • Insert data into the prolog file.
  • Save the object with value into a pl file.

Comment works in the console.

  • Open prolog console or interpreter.
  • Set the directory path of the “pl” file.
  • Use the given prolog file.

[main].

  • You can use the prolog console directly for programming.
  • Use the prolog “not equal” syntax in the prolog console.
  • The prolog “not equal” operator syntax is shown below.

6 == Value 9.

  • The prolog “not equal” operator syntax is shown below.

6 == Value 9.
prolog == prolog.
prolog(A, B) == prolog(C, D).

  • This operator is mostly used for numerical and character values.
  • This function uses the terms of the file.
  • If objects are the same but values are different then the output will change.

The prolog “not equal” operator syntax is shown below.

6 = Value 9.
prolog = prolog.
prolog(A, B) = prolog(C, D).

  • This operator is mostly used for numerical and character values.
  • This function uses the terms of the prolog file.
  • If objects are the same but values are different then the output will change.

Examples of Prolog not equal

Given below are the examples mentioned:

Example #1

The basic prolog “not equal” example and output shows below.

Code:

| ?- 7 == 9.

Output:

Prolog not equal 1

Code:

| ?- 7 == 7.

Output:

Prolog not equal 2

Code:

| ?- prolog == prolog.

Output:

Prolog not equal 3

Explanation:

  • If values are not equal then output shows the “yes” statement.
  • If values are the same then output shows the “no” statement.
  • This operator works on only numerical values.
  • If you try to works on other data type values then the prolog console shows an error.

Example #2

The prolog not equal to the term example and the output shows below.

Code:

| ?- 7 == 9.

Output:

Prolog not equal 4

Code:

| ?- 7 == 7.

Output:

Prolog not equal 5

Explanation:

  • If values are not equal, then output shows the “yes” statement.
  • If values are the same then output shows the “no” statement.

Code:

| ?- prolog == prolog.

Output:

Prolog not equal 6

Code:

| ?- PROLOG == prolog.

Output:

Prolog not equal 7

Explanation:

  • If data are not equal then output shows the “yes” statement.
  • If data are the same then output shows the “no” statement.
  • This operator is working case sensitive for the not equal operation.
  • The uppercase and lowercase characters also make different values.

Code:

| ?- prolog(learn, online) == prolog(teach, online).

Output:

Prolog not equal 8

Code:

| ?- prolog(learn, online) == python(learn, online).

Output:

Prolog not equal 9

Code:

| ?- prolog(learn, online) == prolog(learn, online).

Output:

Prolog not equal 10

Explanation:

  • If object and values are not equal then output shows the “yes” statement.
  • If objects are different and values are the same then output shows the “yes” statement.
  • If objects are the same and values are different then output shows the “yes” statement.
  • If the object and values are the same then output shows the “no” statement.

Example #3

The prolog not equal to the term example and the output shows below.

Code:

| ?- 7 = 9.

Output:

| ?- 7 = 9.

Code:

| ?- 7 = 7.

Output:

| ?- 7 = 7.

Explanation:

  • If values are not equal then output shows the “yes” statement.
  • If values are the same then output shows the “no” statement.

Code:

| ?- prolog = python.

Output:

= python.

Code:

| ?- prolog = prolog.

Output:

| ?- prolog = prolog.

Code:

| ?- PROLOG = prolog.

Output:

Prolog not equal 15

Explanation:

  • If data are not equal, then output shows the “yes” statement.
  • If data are the same then output shows the “no” statement.
  • This operator is working non-case sensitive for the not equal operation.
  • The similar uppercase and lowercase characters are the same.

Code:

| ?- prolog(learn, online) = prolog(teach, online).

Output:

Prolog not equal 16

Code:

| ?- prolog(learn, online) = python(learn, online).

Output:

python(learn, online).

Code:

| ?- prolog(learn, online) = prolog(learn, online).

Output:

(learn, online).

Explanation:

  • If object and values are not equal then output shows the “yes” statement.
  • If objects are different and values are the same then output shows the “yes” statement.
  • If objects are the same and values are different then output shows the “yes” statement.
  • If the object and values are the same then output shows the “no” statement.

Conclusion

The prolog “not equal” is an operator for comparison and arithmetic operation. It determines data or values are equal or not.

Recommended Articles

This is a guide to Prolog not equal. Here we discuss the introduction, how not equal operator works in Prolog? and examples respectively. You may also have a look at the following articles to learn more –

  1. XPath Nodes
  2. How Artificial Intelligence Works?
  3. Web Programming Languages
  4. sprintf Python

The post Prolog not equal appeared first on EDUCBA.

Read original article here: Prolog not equal

Read original article here: Prolog not equal



Disclaimers and Denial of responsibility..!

Denial of responsibility! TheTopMag.com is an automatic aggregator of all media around the world. In each content, the hyperlink to the primary source is specified. All trademarks belong to their rightful owners, all materials to their authors. If you are the owner of the content and do not want us to publish your materials, please contact us by email – jamesonline999@gmail.com . The content will be deleted within 72 hours.
You might also like
Leave A Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.