Jump to content

Falha ao usar operadores de lógica

Vinicius Sena

Go to solution Solved by Zex,

Recommended Posts

Boa Noite,

Estou nos primeiros passo de programação e resolvendo alguns exercícios on-line estou com problemas com operadores de lógica no seguinte exercício:

Using the logical operators you just learned, write an expression that represents the following statement:

"I would like an ice cream with strawberry and either chocolate or stracciatella, or an ice cream of any flavour but caramel."

Declare a variable named iceCream and assign it the logical expression.

var chocolate;
var strawberry;
var stracciatella;
var caramel;

o exercício já declara as variáveis acima, então procedo com o desenvolvimento:

var chocolate = true;
var strawberry = true;
var stracciatella = true;
var caramel = false;
var iceCream = (strawberry || chocolate)(strawberry || stracciatella)!caramel;

porém me retorna o erro: 


>>>>Code is incorrect syntax error Unexpected token '!'

Além da sintaxe, também estou errando na lógica ?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.