I mounted this algorithm in Visualg:
algoritmo "semnome"
var
inicio
se 3 = "a" entao
escreva("igual")
senao
escreva("diferente")
FimSe
fimalgoritmo
And I did not understand, why is the condition returning true?
I mounted this algorithm in Visualg:
algoritmo "semnome"
var
inicio
se 3 = "a" entao
escreva("igual")
senao
escreva("diferente")
FimSe
fimalgoritmo
And I did not understand, why is the condition returning true?
Returns "v" because you wrote your condition like this. You reversed the logic, set it to return "v" when the condition is false.
I tested your code with some changes and other values, but the result continues to get a 'True' Boolean value and printing on the EQUAL screen: Observe ...
algoritmo "semnome"
var
x: inteiro
inicio
x <- 8
se x = "c" entao
escreva("igual")
senao
escreva("diferente")
fimse
fimalgoritmo
I believe it is a bug, even though the value of x is getting the value c even though the declared variable is integer.