[ home / overboard ] [ soy / qa / raid / r ] [ craft ] [ int / pol ] [ a / an / asp / biz / mtv / r9k / tech / v / sude / x ] [ q / news / chive / rules / pass / bans / status ] [ wiki / booru / irc ]

A banner for soyjak.party

/soy/ - Soyjaks

Sojaks
Catalog
Email
Subject
Comment
File
Password (For file deletion.)

File: C#.jpg 📥︎ (209.01 KB, 1920x1893) ImgOps

File: SOYlearningC#LESSON3.txt 📥︎ (1.74 KB)

 â„–15618487[Quote]

We continue learning c#. Yesterday's lesson in LESSON3 text file

 â„–15618715[Quote]

>for
It is a loop that repeats an action you coded, using 3 statements to operate:
<Statement 1 - sets up an iterator with a certain value
<Statement 2 - sets up a condition for the iterator - as long as the iterator meets the condition, the loop will perform the action again and again
<Statement 3 - sets up an action for the iterator - every time the loop acion is executed, a set action is done to the iterator
^example
for (int i = 0; i < 10; i++)
{
Insert code here;
}
^end example
In the example, with statement 1 we set up the iterator - int i that has a set value 0. Statement 2 sets up the condition for the loop - as long as int i's value is below 10, the loop will perform the code. Statement 3 sets up the iterator action - every time the loop code is performed, int i's value goes up by 1 (from the ++ operator).
Basically, int i starts with 0, and with every loop action it goes up by 1. The loop stops when int i = 10 because the condition for the loop is for i to be below 10

 â„–15618815[Quote]

>>15618715
Uniquely enough, for can act wihout specifying some (or all) statements
^example
for (;;)
{
code;
}
^end
In this case, for doesn't have a single statement, making an infinite loop (BUT! You still have to put two ; even if there are statements missing, no matter what)
^example 2
int i = 0
for (; i < 5; i++)
{
Code1;
}
for (; i < 10; i++)
{
code2;
}
^end
In this case, we have int i as a separate value instead of being bound to the loops. Still, since both loops have statements 2 and 3 where they use i, int i will be used in both of them. First loop will act until i = 5, increasing i by one every time from 0 to 5. The second loop will start after the first loop, acting untill int i = 10, increasing i by one from 5 to 10 and stopping when i = 10

 â„–15618825[Quote]

Why would you learn C# over C? C# is just a shitty proprietary verison

 â„–15618831[Quote]

>>15618825
I need it for Unity

 â„–15618911[Quote]

>break
It is a keyword that can end a cycle prematurely
^example
for (int i; i < 100; i++)
{
Code;
if (i == 10)
{
break;
}
}
^end
In this example, we have a for loop that will perform the code until int i = 100. However, inside the loop we also have the if() construction that acts up when int i = 10 - it uses break key word, ending the for loop prematurely before i reaches 100 (statement 2)

 â„–15618916[Quote]

C# lost, Assembly won.

 â„–15618963[Quote]

Can u put all the lessons in a .txt file?

 â„–15618992[Quote]

File: SOY-C#learningLESSON1.txt 📥︎ (5.66 KB)

File: SOYlearningC#LESSON2.txt 📥︎ (2.77 KB)

>>15618963
Later. Here's the previous ones. I plan on making a bulk file every 5 lessons (so it would be lessons 1-5, 6-10, etc.)

 â„–15618996[Quote]

File: IMG_1898.webp 📥︎ (13.25 KB, 255x255) ImgOps

>>>15618963
>Later. Here's the previous ones. I plan on making a bulk file every 5 lessons (so it would be lessons 1-5, 6-10, etc.)



[Return][Catalog][Go to top][Post a Reply]
Delete Post [ ]
[ home / overboard ] [ soy / qa / raid / r ] [ craft ] [ int / pol ] [ a / an / asp / biz / mtv / r9k / tech / v / sude / x ] [ q / news / chive / rules / pass / bans / status ] [ wiki / booru / irc ]