I have an if
statement:
if (inventory.contains("bread"))
But now I want to check
inventory
contains "bread"How can I do this?
It seems that Luiggi Mendoza
and joey rohan
both already answered this, but I think it can be clarified a little.
You can write it as a single if
statement:
if (inventory.contains("bread") && !inventory.contains("water")) {
// do something
}