ENUMS in every programming language (All you need to know)

  Переглядів 25,663

CodeBeauty

CodeBeauty

День тому

📚 Learn how to solve problems and build projects with these Free E-Books ⬇️
C++ Lambdas e-book - free download here: bit.ly/freeCppE-Book
Entire Object-Pascal step-by-step guide - free download here: bit.ly/FreeObjectPascalEbook
🚀📈💻🔥 My Practical Programming Course: www.codebeautyacademy.com/
Experience the power of practical learning, gain career-ready skills, and start building real applications!
This is a step-by-step course designed to take you from beginner to expert in no time!
💰 Here is a coupon to save 10% on your first payment (CODEBEAUTY_YT10).
Use it quickly, because it will be available for a limited time.
☕ If you've found my content helpful and would like to support me, you now have the option to buy me a coffee or a cookie! It's a small gesture of gratitude that means a lot to me and helps me keep creating free educational videos for you. You can use the link below to make a contribution: bit.ly/CodeBeauty_BuyMeACoffee
However, please don't feel obligated to do so. I appreciate every one of you, and I will continue to share valuable content with you regardless of whether you choose to support me in this way. Thank you for being part of the Code Beauty community! ❤️😇
In this video, I'll teach you everything you need to know about enumerations in every programming language.
By using enums you increase compile-time checking of your code and avoid errors that can happen by using invalid constants (numbers or strings). This is because enums let you define which values are legal to use.
You'll also learn about the relationship between enums and loops, enums and functions, casting enums and handling user input, as well as iterating through enum elements and using an enum as a function parameter.
After watching the entire video you'll be able to understand what are enums and apply this knowledge to any other programming language. This will help you to write cleaner code that will be easier to understand and maintain.
👉 Download Visual Assist here: bit.ly/VisualAssistDownload
(It improves Visual Studio experience by quickly identifying and fixing code errors)
Contents:
00:00 - What is enum?
02:53 - How to create an enum?
03:54 - Enums under the hood
05:21 - How to change the value of the enum member?
08:07 - Casting int to an enum (Handling user input)
11:13 - Make your first program with enums (+ tips to fix bugs)
14:10 - How to iterate through enum elements?
17:06 - Enum as a function parameter
Other courses mentioned in this video:
My top 5 Visual Assist features: • My top 5 Visual Assist...
Switch-case for beginners: • C++ FOR BEGINNERS (202...
Error handling with Try-catch: • Exception handling in ...
Do-while loop: • C++ FOR BEGINNERS (202...
Add me on:
Instagram 📸 - / truecodebeauty
Twitter 🐦- / truecodebeauty

КОМЕНТАРІ: 175
@CodeBeauty
@CodeBeauty Рік тому
📚 Learn how to solve problems and build projects with these FREE E-Books ⬇ C++ Lambdas e-book - free download here: bit.ly/freeCppE-Book Entire Object-Pascal step-by-step guide - free download here: bit.ly/FreeObjectPascalEbook 🚀📈💻🔥 My Practical Programming Course: www.codebeautyacademy.com/ Experience the power of practical learning, gain career-ready skills, and start building real applications! This is a step-by-step course designed to take you from beginner to expert in no time! 💰 Here is a coupon to save 10% on your first payment (CODEBEAUTY_YT10). Use it quickly, because it will be available for a limited time. Code from this video: #include using namespace std; enum EyeColor { Brown=1, Blue=22, Green=3, Gray=4, Heterochromia, Other }; void getEyeColorDetails(EyeColor myEyeColor) { switch (myEyeColor) { case Brown: cout
@richardchinomona4676
@richardchinomona4676 Рік тому
You are appreciated. I don't think I would be able to passing my C++ module without you.
@omleen3187
@omleen3187 9 місяців тому
Your accent is so understandable and easy to follow. Thanks a million ❤
@alec_almartson
@alec_almartson Рік тому
Thank you for making this video, I really appreciate it. 💯👍🏻
@ChrisVideosGreek
@ChrisVideosGreek Рік тому
This video is gonna be a great one!
@milkamilkica1935
@milkamilkica1935 Рік тому
Yess, was waiting for this. Your videos are great!
@CodeBeauty
@CodeBeauty Рік тому
enjoy! 🥰🥰
@moodyshah007
@moodyshah007 Рік тому
Thankyou so much! I love your videos, you explain everything so clearly and in a simple fashion. I have learnt so much from you! Thankyou!
@dundyd3612
@dundyd3612 Рік тому
I love your videos Saldina, much better than any other I could find
@CodeBeauty
@CodeBeauty Рік тому
🥰🥰
@neilcampbell6026
@neilcampbell6026 Рік тому
Always good content and presentation style. I always learn things from your videos. You've asked about a complete SQL class/series a couple times--yes from me.
@mosopefoluwaadebawojo3543
@mosopefoluwaadebawojo3543 Рік тому
I really enjoy and learn a lot from your videos. Thank you Code beauty.
@GiorgiBastos7
@GiorgiBastos7 Рік тому
After watching this video I finally could understand the use of enums. Thanks for sharing your knowledge. Regards from Brazil.
@dishant5157
@dishant5157 Рік тому
Always love your teaching styles ❤️❤️❤️❤️❤️❤️❤️
@dandon.3667
@dandon.3667 3 місяці тому
You make me understand every concept in c++ , I love you so much I'm so grateful🥰🥰😍😍😍
@pankajahir9343
@pankajahir9343 6 місяців тому
thank you so much dear ❤🎉
@sunbreeze7354
@sunbreeze7354 Рік тому
Great job as always Saldina!
@CodeBeauty
@CodeBeauty Рік тому
thank you 💕
@4theloveoflife431
@4theloveoflife431 Рік тому
Absolutely great! Your videos are amazing. Enums still give me lots of questionnarks, but you deleted some of them! Great Videos! Keep it up! :)
@jaspreetahir871
@jaspreetahir871 10 місяців тому
tysm for ur videos regarding programming it's helping me and ofc other's alot i'm enjoying alot :)
@savansanghavi7465
@savansanghavi7465 Рік тому
Your videos are better than whatever is available on UKposts. Thanks for sharing ur knowledge. Please make videos about rtti
@peterlaidlaw8655
@peterlaidlaw8655 Рік тому
Hi .. I'm a self taught programmer for embedded hardware .. Feeling playful; my eye colour changes with my mood - 12 today :). I came here to refresh knowledge of Static variables. BYW .. my two fav. teachers are you and David Malan (CS50) .. Thanks much.
@user-yc4gx8eh9y
@user-yc4gx8eh9y 23 дні тому
This video is a masterpiece! Congratulations, Saldina, it helped me a lot!
@CodeBeauty
@CodeBeauty 23 дні тому
I'm happy to hear that 🥰
@-_-5070
@-_-5070 Рік тому
Thank you Saldina♥️ This was really helpful, and it's 2 btw😁
@tuazulyrojoeljean
@tuazulyrojoeljean 7 місяців тому
0 0 Great video! Thank you very much, Saldina! :)
@moexii6308
@moexii6308 9 місяців тому
You're awesome girl!!
@umairahmad2131
@umairahmad2131 Рік тому
Please make full course on Data Structure and algorithm (DSA)
@krystianratajczyk6751
@krystianratajczyk6751 Рік тому
You tutorials are vrey helpful, I have learnt from them a lot, Thanks!
@CodeBeauty
@CodeBeauty Рік тому
🥰
@mehdipira4933
@mehdipira4933 Рік тому
Awesome, thanks.
@diweiye8420
@diweiye8420 6 місяців тому
1, your video has always been so inspiring !
@khaledvevo603
@khaledvevo603 Місяць тому
Thank You So Much
@ammaarsaadat8045
@ammaarsaadat8045 Рік тому
Amazing video. Didn’t get this concept when explained in college. You made it so much easier to understand. EyeColor myEyeColor = (EyeColor) 1; If (EyeColor == 1) {likeVideo();} Else {likeVideo();}
@lmnefg121
@lmnefg121 Рік тому
I just love this one~!
@admoonhermiz1
@admoonhermiz1 Рік тому
thank you!!!
@gollygobih6527
@gollygobih6527 Рік тому
I'm your biggest fan bcz your videos changed my life. I was depressed and couldn't see anything positive and interesting to do with my life until I started watching your videos. now I feel that I'm making progress every day and cant wait for every new video that you publish. love you SALDINA 🌹🌹🌹
@CodeBeauty
@CodeBeauty Рік тому
I'm so happy for you and I'm sure that you'll find happiness and purpose in building great apps that will serve people and our planet for a long time to come! ❤️❤️
@exinangai2216
@exinangai2216 Рік тому
wow, I never thought of prog tut video can help ppl with depression to engage in new activities again. Keep going, pal 😁. If programming & exploring how computers work is your thing, it is a refreshing start to get a taste of "actually living at present" (instead of burying and helplessly struggling with negative thoughts every sec). You may one day become a great programmer among the existing ones. 👍🏻Good Luck & Best wishes to you & your journey of coding. 👍
@phoebewell3653
@phoebewell3653 Рік тому
I was in a similar situation and mine started with a breakup. I also started learning programming and going to the gym because I WANT A BETTER FUTURE for myself. I feel so much better now than just a few months ago. Now I have a purpose and goals for every day in my life. Thank you Saldina, you have a gift for this, don't ever stop, your videos will change many lives ❤️ ❤️ (ps. I also follow you on IG and love your gym stories)
@midenno9987
@midenno9987 Рік тому
Hallo, it is 2+3. Thanks for the effort .
@WDavidCastaneda
@WDavidCastaneda Рік тому
Thank you CodeBeauty! ❤️👍
@CodeBeauty
@CodeBeauty Рік тому
🤞❤️
@kwenjieeohrengsoc987
@kwenjieeohrengsoc987 Рік тому
Thanks
@l.p.1967
@l.p.1967 Рік тому
Thank you for making this video, btw, the question that you asked is 2 😁♥
@tullyal
@tullyal Рік тому
Great video - easily digested over lunch! :-)
@CodeBeauty
@CodeBeauty Рік тому
you can watch this one without even typing the code and still understand how it all works 😏😁❤️
@supportitservices6349
@supportitservices6349 Рік тому
Thank you beuty
@malikmuhammadarslan9993
@malikmuhammadarslan9993 Рік тому
you are really good in teaching
@CodeBeauty
@CodeBeauty Рік тому
🙏💙
@gregorykinney8504
@gregorykinney8504 4 місяці тому
Very Helpful. 2
@rino19ny
@rino19ny Рік тому
hello. please make a tutorial for C++ range based for loop and C++ vectors.
@superboy3625
@superboy3625 Рік тому
Hello... pls post videos on c++ stl. Standard template library.. Your videos are great ..🥳
@akosyt4540
@akosyt4540 Рік тому
enum EyeColor{ Brown=0, Blue, Grey, Green, Heterochromia}; int UserIput; EyeColor eyecolor; do { cout > UserIput; } while (UserIput < 0 || UserIput>4); eyecolor = EyeColor( UserIput); switch (eyecolor) { case EyeColor::Brown:cout
@lachichinqkocev6151
@lachichinqkocev6151 Рік тому
Hi Saldina I em a student and I studying CPP and I em a big fan of your videos can you pls. make video on CPP references pls.
@suryasudha4459
@suryasudha4459 Рік тому
Hello dear. first answer 0 second answer 1 I have a request for you, please do videos in Qt for beginners. Your explanation is more easy and understandable to me. Thanks in advance
@user-gg2ik3nz1v
@user-gg2ik3nz1v 4 місяці тому
i love your explanation , iam from Egypt😍😜
@xthanatos89
@xthanatos89 5 місяців тому
take my follow also 1 is mine!
@mahmoudhamdy4252
@mahmoudhamdy4252 9 місяців тому
My Eye color is 1 😃 thanks for the video
@manoharsagunthalla9215
@manoharsagunthalla9215 Рік тому
Dear Saldana is it possible to define any number of enum and use it? For example say Group - 1 { English, Tamil, Literature etc}, Group - 2 {Math, Physics,Chemistry etc}
@sattorjabborov2728
@sattorjabborov2728 Рік тому
I was trying to understand why we need enums in swift language, and I finally understood it from c++😅❤️❤️
@CodeBeauty
@CodeBeauty Рік тому
for the same reason
@tvrrp
@tvrrp Рік тому
Yep. And enums in Swift are more powerful. For example you can write custom initialisation for enum that take struct as a parameter. And you can iterate throw those structs and assign enum case to itself
@ScaerieTale
@ScaerieTale 2 місяці тому
5 (2 && 1)
@relaxingnatureview79
@relaxingnatureview79 Рік тому
Hello my question is In this video enums as function parameter you just create a function of geteyeclordetail and define switch cases under it it does't related to enums if we write this function without Enum it will work or not
@arjunpoudel6715
@arjunpoudel6715 Рік тому
can you make video for Qt for mac os
@AndreyAntsupov
@AndreyAntsupov 10 місяців тому
Very good video. ( not only that, but others too ) My english is 75% equil google translate, but I'll try to get my point across ) I would like to see a mention that the enum is a global and we cannot create two enums with the same values: enum EyeColor {Blue, Green, Grey}; enum ClothColor {Blue, Red, Green}; We will get an error stating that two identical values ​​are declared ( or something similar ). But at the same time there is an enum class that solves this problem. I would also like to know what and where is more often used on large projects ? ( enum or enum class ) I also heard somewhere that it is correct to write enum values like this: enum EyeColor {BLUE, RED, YELLOW}; because these are constants, but I still don’t understand if someone is still doing this or is already “outdated” ? P.s. if (Brown == 1) { MyEyeColor = 6; } (Gray + Green)
@sewingmachinesindetail
@sewingmachinesindetail 22 дні тому
Thank you for nice video. In your code I saw myEyeColor++ in a for statement. I have tried to make a statement like myEyeColor++; in code, and then the compiler responds, that it is not allowed, and it surprised me. Should a C++ compiler allow this statement? Could it be allowed in C and not in C++? Is your compiler here C or C++?
@emilyve
@emilyve 2 місяці тому
I am 1, i love your character, always watch your videos complete, even the 2,5hour videos, love it
@CSHuang-uw1lx
@CSHuang-uw1lx 2 місяці тому
well explaination, but I have a question, which is EyeColor is an Enum type which contains several intergers. But when declaring EyeColor myEyeColor, the myEyeColor is only a member of the EyeColor? how to realize the data structure of enum and its members and values?
@Timo-Epis
@Timo-Epis 9 місяців тому
isn't "enum class" more appropiate to use?
@colins2
@colins2 Рік тому
Quite a lot of blue-eyed programmers - me too! Why didn't you mention a default value in the switch statements? I always thought that you should, where there could be ambiguity. Great video though👍
@antonnovo695
@antonnovo695 Рік тому
Hi! You should do a java course. I'd devour it.
@darkplayer4371
@darkplayer4371 Рік тому
Can you please make videos on microcontroller programming For beginners If yes please reply so we will wait otherwise you understand 😃😊
@user-rg9hr9gf2t
@user-rg9hr9gf2t Рік тому
EyeColor myEycolor = (EyeColor) 6; Although I'm not sure if cast will work with Rvalue.
@cac2244
@cac2244 Рік тому
Finally an easy to understand explanation... BTW MyEyeColor == 1;
@CodeBeauty
@CodeBeauty Рік тому
👀❤️😼
@deneristargerian6755
@deneristargerian6755 Рік тому
mine is 1 😁😁
@blacksky9571
@blacksky9571 Рік тому
I cannot find the translation
@pimpmetapod7906
@pimpmetapod7906 Рік тому
My eye color is 5 which is mix of 1 & 2 & 3
@CodeBeauty
@CodeBeauty Рік тому
wish I was that cool 👀🥰
@rcookman
@rcookman Рік тому
I have brown eyes too. Lovely brown eyes like yours :) Also enums are great thanks for sharing.
@CodeBeauty
@CodeBeauty Рік тому
👁️ 👁️ 🤎
@ornessarhithfaeron3576
@ornessarhithfaeron3576 Рік тому
👁️👄👁️
@passiondono4692
@passiondono4692 Рік тому
as of 8:05 My eye color is ... Eyecolor myEyeColor = Other; std::cout
@kenopedia7023
@kenopedia7023 5 місяців тому
I learned a lot of for your videos. Hope I will pass the exams😂😂
@CodeBeauty
@CodeBeauty 5 місяців тому
Good luck 🤞🤞🤗
@kenopedia7023
@kenopedia7023 5 місяців тому
@@CodeBeauty I have a request. Please explain checksum c++ .
@kenopedia7023
@kenopedia7023 5 місяців тому
@@CodeBeauty And also the different function of strings function.
@osamahukel8858
@osamahukel8858 Рік тому
I am really so grateful for Allah then you . Because you really help me in c++ . A lot.
@neepunpatil5201
@neepunpatil5201 Рік тому
Well we are close to 200k😄😄
@CodeBeauty
@CodeBeauty Рік тому
Soo close 🥺 ❤️
@Mrclean101
@Mrclean101 Рік тому
int userInput; do { coutuserInput; }while (userInput6);
@ethangold4900
@ethangold4900 Рік тому
As a computer science student, I realized the importance of enums when I revisited one of my projects after months
@MostorAstrakan
@MostorAstrakan Рік тому
4. I've never found much use for enums, to be honest. Your example is for user interaction, but a user is never going to look up their eye color in a table and then enter a number. (It's an example, so fine). I think the main use for an enum is to make numerical codes more readable for the Programmer. For instance if you have a list of increasingly important messages, you could do: enum Severity { ignore=0, debug, info, warning, error, panic, disaster }; And then you can do things like: if(errorLevel >= error) { cout
@davidmorris2848
@davidmorris2848 Рік тому
In the video she says that enums are for the programmer and future programmers who look at the code. I don't recall her stating that they were for the user.
@Timo-Epis
@Timo-Epis 9 місяців тому
Everyone seems to have their own way formating enumerators lol
@heltondeoliveirarodrigues5726
@heltondeoliveirarodrigues5726 Місяць тому
EyeColor=1
@__hannibaalbarca__
@__hannibaalbarca__ Рік тому
Did you know i never used; or very rare; Instead I used const binary arrray
@jeetenzhurlollz8387
@jeetenzhurlollz8387 22 дні тому
she made unreal easy
@amrhesham123
@amrhesham123 10 місяців тому
1
@barimahyaw5446
@barimahyaw5446 Рік тому
Can saldina create a platform like discord where we can ask questions
@CodeBeauty
@CodeBeauty Рік тому
yess, that will be soon 💜 🙈
@barimahyaw5446
@barimahyaw5446 Рік тому
Okay you've really helped me alot and I'm looking forward to it
@charlvanas4665
@charlvanas4665 Рік тому
2
@tuliosilva6720
@tuliosilva6720 Рік тому
My eye color: 1 ^^
@phynx-victumterra652
@phynx-victumterra652 Рік тому
#2 :)
@TheMonkySpanker
@TheMonkySpanker Рік тому
6
@marichka5992
@marichka5992 Рік тому
5
@glebignatski15
@glebignatski15 Рік тому
Green
@thepoloski3498
@thepoloski3498 Рік тому
hello can you help me Im trying to make a code that will decode numbers and this is what I have so far im getting errors and im not sure why #include using namespace std; int main() { int 1, 2, 3, 4, 5,; cout > 1 >> 2 >> 3 >> 4 >> 5; cout
@shukurullomeliboyev2004
@shukurullomeliboyev2004 11 місяців тому
my eyes are blue -gray😁.
@johnromero1537
@johnromero1537 Рік тому
My eye color is 1. By show of hands or thumbs up, who else likes the way our hostess says "parameter"?
@samyaza5752
@samyaza5752 Рік тому
3
@CodeBeauty
@CodeBeauty Рік тому
👀❤️🥰
@SavageScientist
@SavageScientist Рік тому
my eye==1
@shivammavi824
@shivammavi824 Рік тому
9
@Austin-pw2ud
@Austin-pw2ud Рік тому
Gooodddddd,,,,,how is she sooo cute and Smart at the same time!!!!
@us07251
@us07251 Рік тому
ERROR: My eye color is black :(
@illia4658
@illia4658 Рік тому
Color of my eyes is 1
@likami6830
@likami6830 Рік тому
My eye color is 2 :)))
@CodeBeauty
@CodeBeauty Рік тому
😁❤️
@mirzahassan03
@mirzahassan03 Рік тому
EyeColour == other other == Black
@deep_feelinn
@deep_feelinn Рік тому
Other, Black
@CodeBeauty
@CodeBeauty Рік тому
👀❤️
@awakened999
@awakened999 Рік тому
0
@CodeBeauty
@CodeBeauty Рік тому
😁👀❤️
@user-ec7wk1cr6x
@user-ec7wk1cr6x Рік тому
My eye color is 2
Exception handling in C++ (How to handle errors in your program?)
24:46
Variable scopes w\ examples (Local vs Global vs Block vs Nested)
20:12
Teenagers Show Kindness by Repairing Grandmother's Old Fence #shorts
00:37
Fabiosa Best Lifehacks
Переглядів 21 млн
you will never ask about pointers again after watching this video
8:03
Low Level Learning
Переглядів 1,9 млн
the cleanest feature in C that you've probably never heard of
8:13
Low Level Learning
Переглядів 118 тис.
Java Enums Explained in 6 Minutes
5:58
Coding with John
Переглядів 237 тис.
When do I use a union in C or C++, instead of a struct?
11:18
Jacob Sorber
Переглядів 66 тис.
Back To Basics: C++ Containers
31:41
javidx9
Переглядів 173 тис.
C++ OOP - What is inheritance in programming?
16:32
CodeBeauty
Переглядів 129 тис.
I learned to code from scratch in 1 year. Here's how.
41:55
Thomas Frank
Переглядів 300 тис.
Рекламная уловка Apple 😏
0:59
Яблык
Переглядів 665 тис.
Распаковал Xiaomi SU7
0:59
Wylsacom
Переглядів 504 тис.
Эволюция телефонов!
0:30
ТРЕНДИ ШОРТС
Переглядів 4,8 млн