Afrikaans
Akan
Albanian
Amharic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Hungarian
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranรฎ)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
Sometimes when you need to display a collection of things, you might expect that this collection could
be empty for the empty case, you might either combine, if else, with are for each directive or just
more simply used a false directive.
So let me show you the first case with if directive's directives.
So you would use if check if posts contain anything using BHB count function, then we need an else
case.
Render something like no posts found and then close that with and if let's save the changes.
So currently it looks like this because we actually have something inside the post array.
So let's quickly comment that out so we simulate an empty array.
Remember to save the changes.
There it is.
This is how it works.
And let's see how we can simplify it.
Now, let's change for each two for else, so we need to change the starting directive, also the ending
directive.
You don't need this if statement at the top and its closing directive and this alternative case goes
inside and else has to be renamed to empty.
So this is exactly an equivalent of mixing if with for each.
Let's save the changes and refresh.
There it is.
We have the alternative text if we re-enable those entries again.
Now is displaying the items it has to from the collection.
Every loop can skip certain elements using their continued directive or break the loop altogether using
the break directive.
So let's test a break and continue directives inside the existing four hours loop.
So first break one, we will check for the condition when the key equals two.
Make sure to save the changes and this is how it looks, so when the second element is encountered,
it basically stops the loop.
Nothing else would be rendered even if they're supposed Ray would be bigger.
OK, let's cut that out.
And now to continue this time, we will check if key equals one.
So it just keeps the first element, but if this array would contain more than one element, the remaining
elements would be normally rendered.
Inside every loop, you have access to the special loop variable, it has some useful info about the
current loop, let's see a complete table of what is available.
Remember, you can always check that intraplate documentation.
Now let's use the look, even property, and give the old elements on our list a different background.
So let's add if directive and check using this loop variable, if we have an even element, then we
render everything, as it were.
Also, let's add on else case, and this time we will modify things a little bit, maybe by adding a
style.
So using some simple means, we will change the background color to be silver right now, save the changes.
And let's take a look.
So there it is, if we would like to verify it further by adding a third element.
So with index free and something like intro to go langue.
Are we assured that this works?
Finally, let's do an honorable mention of the for loop and the wire loop.
So there is no need to code along, let me just show you the two examples, by the way, this code can
be found inside The View's home index blade up and it would be available on the GitHub if you really
would like to code along.
First, the for loop, which is used to render certain blog and times, so this works exactly like the
for loop in P, P and secondly, the Y loop that will render something unless it condition becomes true.
Now you can see that we have mixed this with using the BHP directive, which basically allows you to
run some PGP code inside your template.
And in our case, I've created a dozen variable.
Then I am checking if it is set to true.
And at the end of every loop iteration I am randomizing a number to be zero or one, and if it's one
I am setting down to true.
So very simple thing.
And it works like this.
So the for loop always renders certain elements and using while loop as you can see me refreshing with
every refresh we get a random number of text.
I am not done rendered.
So that's it.
Everything about Lupe's.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.