2
I built this algorithm into Visualg:
algoritmo "semnome"
var
inicio
se 3 = "a" entao
escreva("igual")
senao
escreva("diferente")
FimSe
fimalgoritmo
And I don’t understand, why the condition is returning as true?
2
I built this algorithm into Visualg:
algoritmo "semnome"
var
inicio
se 3 = "a" entao
escreva("igual")
senao
escreva("diferente")
FimSe
fimalgoritmo
And I don’t understand, why the condition is returning as true?
1
I tested your code with some changes and other values, but the result keeps getting a boolean value 'True' and printing on the value screen EQUAL: 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 receiving the value c even though the variable declared is integer.
1
Returns "v" because you wrote your condition like this. You reversed the logic, put it to return "v" when the condition is false.
No I meant why the condition "if" returns the true condition and not the command write "v", in visualg it executes the command write "f".
Browser other questions tagged algorithm condition visualg
You are not signed in. Login or sign up in order to post.
Returns true or rertorna
v
?– Maniero
Your logic is correct, would return False, but returns true for an unknown reason, I downloaded the latest version of Visualg to be able to test and noticed this inconsistency too, but I tested in the python shell and it worked.
– Félix
Thank you for the reply
– AleKing