Hi , my code output a error and I can’t understand what am I doing wrong
//the exercise:
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.
//my code:
var chocolate;
var strawberry;
var stracciatella;
var caramel;
var iceCream = strawberry && chocolate || strawberry && stracciatella || chocolate && stracciatella && !caramel;
//output this error:
Output
Code is incorrect
‘any flavour but caramel’ can be written as not caramel
Tks for your help, I tried as a string, but still get an error, a different one though…
var chocolate = true;
var strawberry = true;
var stracciatella = true;
var caramel = true;
var iceCream = “I would like an ice cream with strawberry && chocolate || stracciatella || chocolate && stracciatella || an ice cream of any flavour but && !caramel”;
Output
Code is incorrect
There are three possible combinations of ice cream, so your expression should have two ‘or’ operators