Fall through is actually the more useful feature of switch, eg if condition X requires actions 1,2,3 ; Y requires 2 and 3 ; and Z only needs 3. And you are not limited to integer cases, it will accept enumerable types. As with many things in life, just because you can't find the value in something doesn't mean that it doesn't have value to someone else. And this part is speculation as I haven't tested; but I can see the way that switch acts more like a lookup table rather than accepting complex expressions is likely a big performance advantage over complex if statement structures which require inline evaluation at every level. Sort of analogous to compiled verses interpreted source code.
I was curious so I looked, and switch cases are pretty much identical in Game Maker Language. I haven't gone over switch cases in class yet, but I already knew what they functionally did. I wanted to peek ahead and see how complicated it was later, and then I got curious and looked at the GML equivalent.
could you still use switch case with enums when you're using a buffer and were comparing. For example if ((commandBuffer.compare(0, endOfVerb, "north") == 0) || (commandBuffer.compare(0, endOfVerb, "n") == 0)) right now i've got to do for all directions and it's a bit repeated
Technically it is just an editor called Visual Studio Code, not Visual Studio (without the Code) which is an IDE for C++. It is an open-source editor that allows for ide-like functionality with extensions you can install for almost every language. I can highly recommend it and prefer it over more feature rich but more complex IDE's like Visual Studio, Eclipse... . If you depend on refactoring a lot, VS Code might not be optimal. PS: the theme is called Solarized Light and i love it. Edit: Also has great SCM (Source Control Management = Git(Hub)...)
@Bo Bob I like this one, it's more specific so you don't just include a crazy amount of predetermined names, and basic programs only really need std::cout, cin, string etc
@Bo Bob when there are lots of namespaces being used, it can clarify. Say there was a namespace called orange and a namespace called pear. If both had a function called print, how would you know which was being executed. This would be fixed by always saying things like pear::print ect.
@Bo Bob a namespace is (I may be wrong here) a set of preprocessor statements that prefix your code to tell the compiler what library your language is coming from? As in I could create a namespace inside a header file called poop and in order to call functions from my poop I'd have to type everything as poop::whateverIcalledthefunctionImadeinsidethepoopheader So std:: is just a set of instructions a lovely bunch of people cooked into what we call the standard library. I'm sure someone could explain this way better but yeah, that's my understanding. It's just to tell the compiler where the words you're typing in there are defined, because in c++ every little detail has to be outlined properly to work.
I love music at the end of the show!
Fall through is actually the more useful feature of switch, eg if condition X requires actions 1,2,3 ; Y requires 2 and 3 ; and Z only needs 3. And you are not limited to integer cases, it will accept enumerable types. As with many things in life, just because you can't find the value in something doesn't mean that it doesn't have value to someone else.
And this part is speculation as I haven't tested; but I can see the way that switch acts more like a lookup table rather than accepting complex expressions is likely a big performance advantage over complex if statement structures which require inline evaluation at every level. Sort of analogous to compiled verses interpreted source code.
nearly punched my computer if it wasn't for you, thanks for saving me $$$
Caleb are you using visual studio code c++? I asked because I don't know how to run it even after I installed it.
Excellent videos! Keep it up man!
I was curious so I looked, and switch cases are pretty much identical in Game Maker Language. I haven't gone over switch cases in class yet, but I already knew what they functionally did. I wanted to peek ahead and see how complicated it was later, and then I got curious and looked at the GML equivalent.
is it possible to take the case as input by user using cin>>Season?
How do you fetch enums name as string?
Great tutorial, thank you!
Boom, next!
When I do this, I can only access the option that is initialized at the top (Season::Winter).
Did you write code in any of the other cases?
could you still use switch case with enums when you're using a buffer and were comparing. For example
if ((commandBuffer.compare(0, endOfVerb, "north") == 0) || (commandBuffer.compare(0, endOfVerb, "n") == 0)) right now i've got to do for all directions and it's a bit repeated
hi, how come c ++ can interpret the word "season"?
Because he is defining it as an enumeration, like how C++ would recognize names of classes that you create.
Which ide is this?
Technically it is just an editor called Visual Studio Code, not Visual Studio (without the Code) which is an IDE for C++. It is an open-source editor that allows for ide-like functionality with extensions you can install for almost every language. I can highly recommend it and prefer it over more feature rich but more complex IDE's like Visual Studio, Eclipse... . If you depend on refactoring a lot, VS Code might not be optimal.
PS: the theme is called Solarized Light and i love it.
Edit: Also has great SCM (Source Control Management = Git(Hub)...)
Hey Furiosarana! Thanks for the suggestions.
Thanks youu so much
You make it simple. 👍
How the hell are you the guy who does the big Oracle series AND this?
This question is NOT rhetorical.
Celeb Curry is very close to 'Howard - Curry ' ;)
the amount of times he said integrals :( bruh its integers
Ya, that bothered me too😂
This isn't Bucky??
You should use the header file #include so you can just type cout
FranklinGaming using namespace std;
Is what you want
@Bo Bob I like this one, it's more specific so you don't just include a crazy amount of predetermined names, and basic programs only really need std::cout, cin, string etc
@Bo Bob when there are lots of namespaces being used, it can clarify. Say there was a namespace called orange and a namespace called pear. If both had a function called print, how would you know which was being executed. This would be fixed by always saying things like pear::print ect.
@Bo Bob a namespace is (I may be wrong here) a set of preprocessor statements that prefix your code to tell the compiler what library your language is coming from?
As in I could create a namespace inside a header file called poop and in order to call functions from my poop I'd have to type everything as poop::whateverIcalledthefunctionImadeinsidethepoopheader
So std:: is just a set of instructions a lovely bunch of people cooked into what we call the standard library.
I'm sure someone could explain this way better but yeah, that's my understanding. It's just to tell the compiler where the words you're typing in there are defined, because in c++ every little detail has to be outlined properly to work.
Dumbest comment ive ever red
9:05 lol
💖💖
👍
pog
gers
Should have hit the 10 minute mark! More revss
not a single most likely taken