## Difference Between Equality and Equivalence

what is the difference between Equality and Equivalence :

a variable can be equal when a value of variable are the same. example of equal variable but doesn’t equivalent :

int a = 3;

double b = 3.0;

variable **a** is equal to variable **b**, but the both variable are not equivalent, because each variable represent the different type.

variable **a** represent integer type, and variable **b** represent the double type.

example of equal variable and equivalent variable:

int a = 3;int b = 3;

variable **a** and variable **b **are equal and equivalent, because both variable has the same value and data type, integer type

equality or equal is about symbol = , equivalent is about symbol >, <

example :

a = 3;

b = 3;a = b (a is equal or equality with b)

Isn’t it the other way around? The first part where you are comparing int a and double b. They are equivalent but not equal.

AvinashNovember 13, 2014 at 5:45 am

in programming a variable is equivalent when represent the same data type, and can be called equal when have the same value🙂

snippetjournalNovember 13, 2014 at 1:13 pm