[ 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#LESSON4.txt 📥︎ (3.07 KB)

 â„–15620685[Quote]

MILESTONE LESSON 5 IS HERE! After this lesson I'll make a big file that contains lessons 1 to 5, with better structure for reading. The previous lesson cam be found in the text file

 â„–15620690[Quote]

why is it that every single time this thread is posted, it gets deleted and replaced by a GOARMY.com thread?

 â„–15620695[Quote]

>>15620685 (OP)
How does this help israel our greatest ally?

 â„–15620767[Quote]

>nested loops
These are loops that are placed inside other loops. Any type of loop can be placed within another
^example
while()
{
for(;;)
{
code;
}
}
^end
The loop for is nested inside the loop while

 â„–15620787[Quote]

>>15620767
There's not really limit to how many loops you can nest inside other loops(as long as what you're doing is working properly). Also, you can nest loops inside other nested loops, so there can be loops within loops within loops…

 â„–15620876[Quote]

>ternary operator
It is an operator that performs an operation on 3 operands. In its' nature, this operator is similar to if()-else construction, but is more compact code-wise
^example
(Operand1 - condition) ? (Operand2 if_true) : (operand3 if_false)
^end
This is a basic syntax for a ternary operator: operand1 is used as a condition to be fulfilled. Then the operator asks a question ? if this condition is true or false - if it is fulfilled (true), then operand2 takes action. Else : operand3 takes action

 â„–15621050[Quote]

>>15620876
^example 2
bool accessAllowed;
string truePassword = "Nophono";
string enteredPassword = Console.ReadLine();

accessAllowed = truePassword == enteredPassword ? true : false;

Console.WriteLine(accessAllowed);
^end
In this example, we code in a bool value acessAllowed for further use. We also have two string values - truePassword with set value "Nophono" and enteredPassword that has a value we enter in the console with wih the use of Console.ReadLine() - basically we write letters, program reads it and assigns what it sees to enteredPassword.
Now we assign a value to bool accessAllowed, which is calculated by a ternary operator:
<Operand1 - truePassword == enteredPassword
Operand1 checks if what we wrote in the console (enteredPassword) is the same as truePassword - them being equal is a condition
<Operand2 - true
If we entered Nophono, then our enteredPassword has char value "Nophono", which is equal to truePassword, meaning that our condition (Operand1) is met. That means our ternary operator uses Operator2 - true, hence bool accessAllowed = true
<Operand3 - false
If what we wrote in the console doesn't match truePassword's value, then Operand1 condition is not met - the strings aren't equal. In which case the ternary operator uses Operand3 - false, meaning bool accessAllowed = false
In the end, we use Console.WriteLine(accessAllowed) to write accesAllowed's value into the console - if we wrote Nophono, then Operand2 is used, so we'll see true. If we wrote something else, Operand3 is used, so we'll see false

 â„–15621098[Quote]

File: 1773050503258y.mp4 📥︎ (1.34 MB, 560x560) ImgOps

>>>15620876
>^example 2
>bool accessAllowed;
>string truePassword = "Nophono";
>string enteredPassword = Console.ReadLine();
<reddit space
>accessAllowed = truePassword == enteredPassword ? true : false;
<reddit space
>Console.WriteLine(accessAllowed);
>^end
>In this example, we code in a bool value acessAllowed for further use. We also have two string values - truePassword with set value "Nophono" and enteredPassword that has a value we enter in the console with wih the use of Console.ReadLine() - basically we write letters, program reads it and assigns what it sees to enteredPassword.
>Now we assign a value to bool accessAllowed, which is calculated by a ternary operator:
><Operand1 - truePassword == enteredPassword
>Operand1 checks if what we wrote in the console (enteredPassword) is the same as truePassword - them being equal is a condition
><Operand2 - true
>If we entered Nophono, then our enteredPassword has char value "Nophono", which is equal to truePassword, meaning that our condition (Operand1) is met. That means our ternary operator uses Operator2 - true, hence bool accessAllowed = true
><Operand3 - false
>If what we wrote in the console doesn't match truePassword's value, then Operand1 condition is not met - the strings aren't equal. In which case the ternary operator uses Operand3 - false, meaning bool accessAllowed = false
>In the end, we use Console.WriteLine(accessAllowed) to write accesAllowed's value into the console - if we wrote Nophono, then Operand2 is used, so we'll see true. If we wrote something else, Operand3 is used, so we'll see false



[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 ]