Java for Fucking Idiots: Learn the Basics of Java Programming Without any experience!



Download 3,91 Mb.
Pdf ko'rish
bet36/70
Sana02.04.2022
Hajmi3,91 Mb.
#524999
1   ...   32   33   34   35   36   37   38   39   ...   70
Bog'liq
Java for Fucking Idiots

boolean
havingFun =
false
;
do
{
//A game of League of Legends sets havingFun to true or false.
}
while
(havingFun);
In place of actual code, I left a comment there that describes how such code
would work.


In this code, we always play one game of League of Legends, even if we
aren’t yet having fun today. Then, if we are having fun, we keep playing
until it’s no longer fun.
But really. I have never once encountered a scenario where I found I wanted
to use a do while loop. Maybe I’m just an idiot.
Like with anything there will be someone who argues otherwise; maybe
using a do-while loop 0.00001% of the time it makes the code easier to
read. But I can’t be bothered to care.
You can always write it to fit into the other 2 primary kinds of loops, while
loops and for loops.
Did someone say FOR loop??
First of all, why another kind of loop? We already have a way to do things
repeatedly with the while loop. And we have a stupid way to do it with the
do while loop.
What else could we possibly need to loop through data, do things over and
over until something changes, etc.?
Let’s summarize how we wrote a 
while
loop for looping through an array.
1. Declare an “index” variable that is used while looping.
2. Write the condition that determines when the loop should keep
going or stop.
3. Increase the index at the end of the loop.
The for loop (promo code steve)
Well, scientists have invented a type of loop that does all of that much
easier! Check out how you’d write a loop the old way, versus with this new
type of loop!
//While loop
char
[] myArray = {

Download 3,91 Mb.

Do'stlaringiz bilan baham:
1   ...   32   33   34   35   36   37   38   39   ...   70




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish