Now, that we learned about this new EJS syntax
that helps us with, for example, writing a "for loop",
we can use that same syntax to also output content
conditionally,
because that's something else you often want to do.
Sometimes, you have different circumstances that influence
which content should be shown.
For example, let's say here, what if we had no restaurants?
What if I temporarily cut all the restaurants in there
so that I have an empty array again,
and I saved this Jason file.
Then at the moment we say "We found 0 restaurants",
and we don't show any list.
It's not too bad,
but we also show "Find your next favorite restaurant",
and we might overall want to show a different message in
case that there are no restaurants at all at this point.
And to do that, we can go back to "restaurants.EJS",
and again, use this syntax,
but this time for an "if" statement.
And if I want to show these paragraphs and this list,
only if we have restaurants,
then we can add a "if" statement here.
Here without the equal sign because again,
we don't want to output a single value,
but write a more complex JavaScript statement.
And here we can then say if,
and then simply check
"if number of restaurants is equal to 0",
and if that's the case, then we want to do something.
Don't forget the opening parentheses "else",
we want to do something else.
So for this, we can then close the "if" block here.
And also if we want to add an "else" or "else if" statement,
in my case, "else", and open a new block,
and then also close this block here at some point.
So that's how we could write that "if else", statement.
And now I want to output a special message
if we have no restaurants.
For example, I want to say,
"Unfortunately, we have no restaurants yet,
maybe start recommending some?"
Anything like that.
"Else", if number of restaurants is greater than zero,
we want to show our restaurants and these paragraphs.
So then I'll grab all that code here
with the other of lists.
and the paragraphs, and dragged that into this block here.
Just like that.
And now with that, if I save this and I reload,
I get this message because I deleted the restaurants
from the Jason file.
If I go back to the Jason file
and I re-add those restaurants here,
and I saved that file.
Now if I reload,
I instead get my other text and that list.
So conditional statements are another key feature,
and thanks to this special EJS syntax we learned about
with this tag here,
it's very easy to add that kind of feature.