Thinker
Thinker
CC#
Created by Faker on 1/25/2025 in #help
Expression vs Statement vs Expression statement in programming
np :meow_owo:
20 replies
CC#
Created by Faker on 1/25/2025 in #help
Expression vs Statement vs Expression statement in programming
However, when you call a method, that might do something, but it may also return a value! That is why we can call methods both as statements and as expressions, eg. we can call a method like int x = DoSomething() + 1; but also as DoSomething();. When we specifically use a method call as a statement, that is called an expression statement.
20 replies
CC#
Created by Faker on 1/25/2025 in #help
Expression vs Statement vs Expression statement in programming
x + 1; doesn't make sense because it doesn't "do anything"
20 replies
CC#
Created by Faker on 1/25/2025 in #help
Expression vs Statement vs Expression statement in programming
yep
20 replies
CC#
Created by Faker on 1/25/2025 in #help
Expression vs Statement vs Expression statement in programming
A statement is something which does something, for instance Console.WriteLine writes to the console. An expression is something which returns a value, for instance x + 1 returns the value contained within x plus 1.
20 replies
CC#
Created by Faker on 1/22/2025 in #help
✅ Error handling in C#
And LanguageExt is kinda terrible for what it promises to do anyway
80 replies
CC#
Created by Faker on 1/22/2025 in #help
✅ Error handling in C#
There's a time and place for result types, but everywhere in your code is not that
80 replies
CC#
Created by Faker on 1/22/2025 in #help
✅ Error handling in C#
god no don't use language ext
80 replies
CC#
Created by Faker on 1/22/2025 in #help
✅ Error handling in C#
ooh right, sorry, didn't read your message properly
80 replies
CC#
Created by Faker on 1/22/2025 in #help
✅ Error handling in C#
also yeah task cancelation ig
80 replies
CC#
Created by Faker on 1/22/2025 in #help
✅ Error handling in C#
However note that exceptions are still alright to use, but only in situations where there are no reasonable alternatives, such as reaching a state which should in theory never be reached.
80 replies
CC#
Created by Faker on 1/22/2025 in #help
✅ Error handling in C#
(in general you want to avoid exceptions as much as reasonably possible tho)
80 replies
CC#
Created by Faker on 1/22/2025 in #help
✅ Error handling in C#
trying to pass a string to a method which expects an int is a compile-time error, not a runtime one
80 replies
CC#
Created by Faker on 1/20/2025 in #help
Switch statements
It's incredibly powerful and can be used to great extent to achieve some very cool things
32 replies
CC#
Created by Faker on 1/20/2025 in #help
Switch statements
If you wanna read more into this, it's called "pattern matching"
32 replies
CC#
Created by Faker on 1/20/2025 in #help
Switch statements
Since they can match a lot more stuff
32 replies
CC#
Created by Faker on 1/20/2025 in #help
Switch statements
Yeah, C#'s switch statements are a bit more versatile that in a lot of other languages
32 replies
CC#
Created by Faker on 1/20/2025 in #help
Switch statements
which will execute the branch if the value is between 5 and 10
32 replies