Am I reading this right?
in this code :
for (int i =0; i < 5: i++)
{
Console.WriteLine(i);
}
So am i understanding this right?: First you have to declare statement 1 witch is int i = 0; once this is declared the complier execute the code block that contains Console.WriteLine(i); statement 2 defines the condition for executing the code block. statement 3 is executed everytime after the code block has been executed?
30 Replies
Am I understanding this right *
Basically, yeah
is how you could describe a for loop
Thanks for your reply I will now go over it !
But is this also true
Like is statement one ran and then the code block runs after that statement 2 and 3 are ran by the compiler ?
@ZZZZZZZZZZZZZZZZZZZZZZZZZ
Like statement 1 first ran and then the code block is ran behind the scene and then statement 2 and 3 ran?
Can someone answer my question c:
?
u made a typo its supposed to be ; not :
Oh ops
But am I right ?
First runs statement 1, than statement 2, than code, than statement 3
Are you sure
@blueberriesiftheywerecats
?
Can someone help me D:
Chill, the world's not gonna end if you don't get an answer for 10 minutes
Angius
REPL Result: Success
Console Output
Compile: 500.659ms | Execution: 50.925ms | React with ❌ to remove this embed.
See for yourself
Sorry buddy didn’t mean to offend you
You did not
It's just a word of advice that if you expect people to always answer the minute you post a question, you're not always gonna get that
Okay 🙂
is a string literal , litteraly just something along the lines of "Console.WriteLine("Hello how are you today")
A string literal is literally just a string
So
"hello world"
okay ty 🙂
what does null mean?
also are + ,- ,/ , * considered unicode characters
null keyword - C# reference
null keyword - C# Reference
ty for the link
can break be used to exit from a for loop, while loop, a do while loop, a for each loop ? like all of theses?
From any loop, yes
Most characters fit the Unicode range
And when it comes to null...
thank you for your reply you've been really help ful!
is there a website
where you can paste your code and it lines up all the brackets for you automaticallyh
i messed up my brackets and it feels like a pain trying to figure out where i should put oned
one*
Yes, imagine if int i = 10 and statement 2 is i < 5, why would it even run? So yes im sure
Check format keybindings in your ide
@blueberriesiftheywerecats "For the loop, starting with int i equal to 0, while i is less than 10, increment i by 1 after each iteration. Inside the loop, print the value of i to the console."
@blueberriesiftheywerecats "For the loop, starting with int i equal to 0, while i is less than 10, increment i by 1 after each iteration. Inside the loop, print the value of i to the console."
is this the correct way to read this for (int i = 0; i < 10; i++)
{
Console.WriteLine(i);
}
Yes
ty mate 🙂
No need for a website
$prettycode
To format your code in Visual Studio, Visual Studio Code, Rider, use the following shortcut:
NOTE: the first key must be held while doing it.
https://cdn.discordapp.com/attachments/569261465463160900/899513918567890944/2021-10-18_01-26-35.gif
=
so the order is statement1(int i=0) , then statement2( i<5), if statement 2 satisfies code block is executed and then statement 3, if statement 2 result in false , it will directly skip the code block and statement 3.