Welcome back to the AI for good global summit here in Geneva and we have a familiar face I'm sure a mere benefit to me general manager innovation for the X Prize What's different as you've been going through the corridors and taking part of workshops this year Thank You Chris This year has been phenomenal We have seen the growth of the event from year one in 2017 up to now The amount of sessions that have been increasing and the conversations ranging from the typical United Nations sustainable development goals topics that we have selected this year and five of them We added some new topics this year on space and culture and Diversity and also scaling AI Which has been additional to what we've done last year and that increased the number of sessions a number of panels a number of workshops And obviously the number of speakers and participants So this has created a whole new dynamics in the event and we see that the growth of the event is also sustained By real conversations between stakeholders that are interested in AI for good But also more innovators and entrepreneurs that are joining. We've heard the word scaling a lot for someone Who's just arrived from the moon. What does that mean? Scaling is interesting term. We're referring to scaling as if we know how AI can be used for good How can we build capacity to scale more to offer that to more countries to more individuals to more constituents to more communities? And make sure it's responsibly scared with also security scale So this term is being used a lot in this in this summit Yeah, you mentioned that a lot of diversity gender neutrality have been key themes this year Why why would they have to be singled out this year? As we learn more and more about how AI is being used and the biases that could be created when you create those algorithms and Solutions we need to be aware that we need to take into account not only biases that come from data But biases have come from problems that are defined and those problems have to be find more at those source By those who own the problem and that requires diversity of approaches diversity of culture diversity of knowledge And therefore you have to integrate way more communities and cultures and language and geographies to make sure you do things to account That diversity that will take time It will take obviously very time and the three years that we've started with this event We'll probably need to sit at another few years to make sure that we hit that goal last couple of questions now Obviously there's been a lot of candidates downstairs for the X-Price. What do you think so far what they've got to offer? We have been Lucky this year to be able to coincide the summit with our annual X-Price competitors team summit and Because of that we had about 70 teams that have joined around the summit and they're showcasing now to the audience the solutions that they're working on And all those solutions are AI for humanity AI for sustainable goals And that has been very interesting and intriguing for the audience because this is the first time they can see in such a small space all those all those efforts We've had a couple of futurologists coming in talking so if you put on your futurologist hat Where do you see this three years from now? The summit you mean. I think the summit could become the place where we talk about real Policy and governments of AI and how AI can be used really for good, but for multi-stakeholder perspective But also include academia and the real pushers of science in AI come together Okay, thanks very much. That was a mere benefit to me from the X-Price and General manager of innovation for this, so thank you very much for your time


The Swing Lab is a dynamic problem that will help your students explore the motion of a Swinger by modeling the horizontal and vertical positions of the Swinger over time. In this video, we'll show you how to use the Swing Lab in a classroom setting. To do this lab, you'll need the video, the animation, the handouts, data sets, and a calculator. Links to these files are provided in the YouTube description of this video. First you'll want to show the movie of the Swinger to the entire class. As you watch the Swinger with your students, ask your students to think about breaking up her motion into her vertical position and horizontal position over time. The distance between the top of the two orange cones is approximately 72 inches. Ask your students to think about how high she swings or how far left or right she is from the center of her swing. We can use the animation of the Swinger to help students see how the horizontal and vertical positions of the Swinger change over time. Well, we will overlay a coordinate system on the Swinger so that the middle position is zero. We will mark her starting position and we can see that her starting vertical position is shown by the blue arrow and her starting horizontal position is shown by the red arrow. In this system we can see that when the Swinger is to the left, her horizontal position is negative and when she is to the right of the middle position, her horizontal position is positive. As we watch the animation, we can see the graphs of the Swinger's horizontal and vertical position over time. As we step through the animation, we can point out important features of the graphs as the Swinger is in motion. For example, we can see that when the Swinger is at the bottom of her swing, the graph of the vertical position is at a minimum and the graph of the horizontal position is close to zero. Students should watch the video of the Swinger in the animation as many times as needed. When they're ready, it's time to work through the questions on the student handout lab sheet. They will need access to the actual data points for the vertical and horizontal position of the Swinger. The data is provided in two Excel files, one for vertical and one for horizontal, or TI-83-84 data sets. A partial data set is also provided at the end of the student handout. After students work on parts one and two of the lab sheet, you should show the video again and have half of the students say up and down when the Swinger is at the top and bottom of her swing. Then have the other half of the students say left and right when the Swinger is at the left-most position and right-most position. We can hear one group of students talking more frequently. This helps to illustrate that the Swinger moves up and down twice as often as she does left and right. This should help students understand why the period of the horizontal graph is half of that of the vertical graph. We can also see this important relationship between the periods of the two functions by comparing the graphs on the same set of axes. Finally, we will use the TI graphing calculator to graph the horizontal position of the Swinger against the vertical position of the Swinger. Press mode, choose parametric. Press y equals. Type your equations in x of t and y of t. Press the window button. Set an appropriate window. For example, t min equals zero, t max equals eight, since this is time in seconds, t step equals zero point one. x min equals negative seventy, x max equals seventy, x scale is ten. y min equals zero, which represents the ground, y max equals one thirty, y scale is ten. You can change the trace type in y equals. Now press graph. This lab activity gives students an opportunity to create trigonometric functions to model a real-world problem.


When you think of history and sneakers, what is the first year that comes to mind? Jordan won, Chicago's. Jordan won, Chicago. Everybody likes the Chicago's. When you think of sneaker history, what is the first year that comes to mind? My car minds. Car minds. Those are my favorite pair for a long time. My car minds. I love to hear it. Somebody finally said Jordan 6's, baby. When you think of sneaker history, what is the first year that comes to mind? Jordan 2's. I'm weird. I'm weird. I like Jordan 2's. I respect.


You should just be trying to model yourself after Jesus and what did Jesus do? He literally loved and accepted and hung out with every single person. Literally every single person down to the person who was being crucified right next to him who was an awful sinner in the world's eyes. He even told him, hey, you're going to be in heaven with me. Was Jesus about love and acceptance? Absolutely. God demonstrated his own love for us that while we were yet sinners, Christ died for us. He welcomed us into his family despite our sin, rebellion, and flaws. Through his grace we are totally accepted. However, it's important not to minimize other aspects of God's character. Jesus was about love and acceptance, but he was also about repentance and truth. Jesus never approved of every behavior. In fact, he called out people that were living contrary to his commands. He called the Pharisees to repentance for their pride. The woman caught in adultery was shown Jesus grace, but she was also called into repentance when he said, go and sin no more. Jesus love isn't just warm and fuzzy. It is grounded in truth. When we try to minimize aspects of God's character to make him seem more appealing, we're actually creating an idol. I want to encourage you to embrace all of the attributes of God, his holiness, his wrath, his love, his acceptance, his grace. He is amazing. Follow for more Christ-centered content.


Good morning, John. I just wanted to let you and everybody know that I'm not making a video today.  You can have some days that you take off. You know, like, I just looked at my calendar on Tuesday. I had some time on Tuesday to make a video, and I was like, but I hadn't seen your video yet. You hadn't uploaded your video during that time. And also, like, I had, like, some surprise curveballs that came my way, family things. And so I wanted to prioritize those things, which I think everybody understands that we do and would do and should do, and, like, you don't have to tell me, like, we support that. Of course, you support that. I get that. Which is one of the things I love about this. I think that it is clear that we are not focused right now and haven't for a while on growth. Like, this is a thing that everybody here is doing together. Even if you just watch and never comment and you're not excited, like, maybe you're not even excited about Pizzamas. Maybe you're just, like, coming for, I don't know, I don't know, whatever it is for you, you're part of it. And I think that, like, we need to understand that generally about the media that we engage with is just by being there. You are part of it. I've been thinking a lot about how we don't know what we're signing up for when we sign up for the thing that we end up doing. You were asking me to do this. In 2007, I said, yep, what a concept. And then, here we are. It's 2020. The future jet packs actually, now we actually have the Iron Man suit. And the thing that this is would be not this. It would either not exist or it would be deeply different if it weren't for the people who engage with it. If only just watching, not even clicking the like button. If only just like clicking on the thing and watching the video. It would not be this thing. Did I have something to do with what it is? Yeah, you did too, John. But, like, we are so lucky that it was possible to make something like this. And it's only possible to make something like this because the people who engage with it. The people who give us their attention. And we need to find things like that to engage with and do it and let it be part of what we are and part of how we figure out how to imagine the world. It's so crappy right now. And I know that my brain is designed to more heavily weight the bad stuff than the good stuff. And so I know that when people are trying to influence me and the rest of the world, they're going to focus on the bad stuff. And they're going to make me think less of everything in order to get me to not vote or in order to get me to buy a thing that's going to make me feel better about myself for a moment. There's a thing called anchoring bias. I think about it a lot where you have certain ideas that you go to ideas and I think it's an impossible thing to avoid. And since it's impossible to avoid, you have to pick good anchors. And one of the things that I anchor to is the idea of negativity bias. So I'm using my anchoring bias to anchor to the idea that my negativity bias exists. And that just reminds me that the world is probably and people are probably better than I think. And that's at least something. Anyway, all that is beside the point. I'm just here to tell you that I'm not going to make a video this week. And I know that it's okay that I don't make a video this week, even though I have made a video every week on my day for like more than 10 years. And so it feels really weird not to. Okay, that's all. John, I'll see you on Tuesday.


Hi, I'm Jan Van Sickle, and I teach the GPS GNSS course here at Penn State. Let me tell you a little bit about what GNSS means. It's the Global Navigation Satellite System. Now GPS is part of that system, but there's other constellations involved. For example, the Russian GLONASS system, the European Union Galileo system. The point is the technology is changing fast and really quite dramatically. So this course is about those changes. It's about, yes, the nuts and bolts of how everything works. That's true, but this is not an abstract investigation. This is practical. I'm trying to give you the tools that you need to take full advantage of this technology and use it the way that it will give you the most benefit. That's what the course is about.


Hi friends. Welcome back to my channel and happy Friday. I'm actually filming this video on Thursday because we are heading out camping to Priest Lake for the weekend. So I won't be here to attend my virtual workshop on Friday and film and edit and upload this video for you guys. So I decided to go ahead and wait in one day early. So I went and wait in this morning, hopped online, printed off the information on what we're talking about at the virtual workshop. And I thought before we headed out of town that I would film my way in for the week one day early, of course, as well as the topic that we would have discussed at the virtual workshop. It's quite interesting. I'm able to download print the weekly so I can see what we were going to talk about. I just don't get the additions of my leader and the other people that are part of the virtual workshop. But I really like this topic. And I think that I can share some valuable insight with you guys, even though I didn't actually get to attend the virtual workshop. So without further ado, let's jump into the workshop and my way in. This week's topic is taking charge of unhelpful thoughts. Now in a nutshell, this basically means that if you find yourself at the bottom of a box of cookies and you've eaten the entire box, what was the cause of you doing that? Were you telling yourself, I'm not losing any weight? I can't do this. I might as well eat these cookies. It's quarantine.  This is my reason to eat whatever I want to eat. Or I'm extra hungry today. I'm just going to go ahead and eat this whole box of cookies and I'll just figure it out later and start over tomorrow. So those are some unhelpful thoughts that we can tell ourselves that lead us to do things that maybe we generally wouldn't do if we weren't having these unhelpful thoughts. So today we're going to talk about what these thoughts are and how to combat these so that we don't find ourselves at the bottom of an empty box of cookies. So let's use an example that I've honestly done myself more than once, several times. And that is we screw up. We eat something that knocks us out of our smart points budget. Maybe we splurge or we have an extra cheat day and we think great. I've ruined my entire week. I'll just start over next week and we continue to eat poorly the rest of the week. Who's done that? I've done that more times than I care to admit to be completely honest. So we're going to use this as our example on how to stop these unhelpful thoughts. So when we find ourselves telling in our mind out loud we've ruined our week, we're just going to give up for the rest of the week, the rest of the month, the rest of the year. We need to shift those into positive thoughts. For example, if you splurge and ate a cheat meal and you're way over your points, you're in the negative of your weeklies, tell yourself, it's okay. I can start over on my next meal. I can start over tomorrow. One slip up or eating all of my weeklies may not even impact my weight loss. I'll make it up with eating good the rest of the week. So see the difference in how we talk to ourselves and what thoughts, whether they're helpful or unhelpful, we tell ourselves that really could lead us to a positive or negative result.  Chances are I'm going to see a gain, maybe even a large gain on the scale. But if I shift my unhelpful thoughts to positive thoughts and I say, okay, today's over. Did I screw up? Absolutely. But I'm starting over. I'm going to get right back on track and combat today and see that loss on the scale at the end of the week. I love this second one. And this is give yourself a reality check.  If your friend loved one family member, fellow WWR came to you and said, oh my God, I have ruined my entire week. I had McDonald's. I had fries. I had a burger. I had all the things. Would you tell your friend, yeah, you're right.  You might as well just throw in the towel. No, you would tell your friend, just get back on track. The next meal, the next day, whatever the situation may be, and you can make up for your little bit of a screw up. That's what you would tell your friend.  So don't do that to yourself. Don't tell yourself you've ruined it. When in reality, you can simply start over and get back on track. And chances are you may even make up for that little splurge on the scale and still see a lot. It comes down to all or nothing thinking and I, that is me, you guys, that is me in a nutshell, Jen, all or nothing thinking Clayton. That should be my name because I am like that. I'm either a hundred percent in or I'm a hundred percent out and I am like that in so many areas of my life. And I know that about myself. I'm extremely self aware and I know that, that about myself. So when I start that all or nothing thinking when it comes to WWR and I do that probably once a week to be completely honest with you. I find myself in my pantry wanting to have cookies or something I shouldn't eat. And I say, well, if I'm going to have a cookie, I might as well eat the whole box because I'm having a cookie. I have been practicing changing my unhelpful thoughts to helpful thoughts and telling myself, you can have one cookie, track it and move on. You don't need to eat the whole box. Now, am I successful every time? A hundred percent no. There are times I eat the whole box. I'm not going to lie. You guys know I am honest with you and that is the honest truth. There are times that I let the unhelpful thinking get in the way, the all or nothing attitude. But I've really been trying to be mindful of when I catch myself in that all or nothing attitude, that all or nothing mindset and trying to shift out of that so that I'm not sabotaging my weight loss. Let me know down in the comments if you're similar to me where you do have that like all or nothing mentality. It's tough. It's tough to move past that. But you just have to figure out that you are like that and do your best to make changes when you find yourself getting into that mindset. And lastly is accept and act. Accept that you made a mistake and act on it positively. Start over, start fresh, make a game plan to get out of that all or nothing mindset. If you're in that to get out of that, I've already ruined my whole week, my whole day, my whole month, my whole weight loss journey and shift it into something positive. I sometimes struggle with the get back on track on the next meal. That isn't always how my mind works for me. Sometimes it has to be the next day. Sometimes I just want to throw in the towel for the entire day and I tell myself the next day I'm getting right back on track. And I don't think there's anything wrong with that as long as we are getting right back on track the next day or the next meal or whatever it is that we promised ourselves. So I like this topic a lot. I feel like it really resonates with me. And man, this is raw and uncut. You guys are getting a lot of truths thrown your way from me today. So I am really guilty of this, especially the all or nothing mindset. And I'm glad that I'm able to recognize that so that I can try to improve upon that and make that better throughout my weight loss journey. And really my life in general, I find myself with that mindset in my life. So for me, that is a big focus. And I've really, really been working on that throughout my weight loss journey, especially over the last few months when I've really been able to identify that that's kind of how my mind works. So bottom line is take those unhealthy thoughts and turn them into healthy thoughts and remember, and I think this is huge, you guys, tell yourself what you would tell your friend or your loved one.  So now that I've just thrown who knows how many truth bombs your way, let's talk a little bit about my week. So as you know, like I mentioned, it's only Thursday, so I'm one day early in my weigh-in, but I had a pretty good week this week. I did track calories and smart points. I'm trying to do an experiment before I actually put out my what I eat in a week calories versus points. Speaking of calories yesterday, I uploaded my how to figure out your calories video. You guys have been begging for calorie videos, macro videos. So I did a little mini series and this was the second one in that series where I talked about different ways to figure out your calories using the WW app, using other apps and the reason why we should watch our calories even though we're on WW. So make sure you guys check that out. Also a couple of weeks ago, I updated my point or uploaded my points versus calories video. Highly recommend you watch that as well. That was the first one in this four-part mini series about calories versus points. So I took that to heart this week and really did track both calories and points. I stayed within my calorie range this week, which was my goal. Did I stay within my points? Not every day, but I made sure that I stayed within my calories. More to come on this of course. And when I stepped on the scale today, even though it was one day early, I'm down 1.2. I'm incredibly proud of myself for that. I am loving this new little bit of approach and this new thinking that I have towards my program and it seems to be working. So I'm starting June off with a bang, being down 1.2 pounds. I told myself June is going to be a good month. June is going to be more than a three or four pound loss at the end of the month. I'm committed to that. So I'm heading out camping this weekend. Like I said, camping can be a little bit of a struggle for me, but I am on my way right now to do my grocery shopping and I have several healthy meals planned. I'm going to film the entire thing, which really helps me stay on track as well. You guys love coming camping with us, seeing what we're doing, diesel and Lola. So stay tuned for that video coming out this next week. And I am looking forward to another successful week. I mean, that's really the bottom line. Camping trip included, I'm going to stay on track. I'm going to use my weeklies on Friday tomorrow so that I can have a s'more or something in the afternoon as a sweet treat. And then we're going to have hamburgers for dinner, which I'm super excited about. Hamburgers are my jam. It's one of my favorite foods and I want like a big greasy burger. So that's what we're going to have for dinner tomorrow night. I should be getting in lots of activity with walking to and from the lake and I can't wait to just get away, relax and be in peace for a few days camping. So this week also was not my week for exercise. I actually didn't do jazz or size at all, but I did spend quite a bit of time in my yard. In fact, yesterday I had 90 active minutes just in my yard, spraying weeds, pulling weeds. And I did one more thing. Can't remember what it was something else for my husband. And I ended up with about 90 active minutes in the yard. So I am back on the Jazzercise bandwagon next week. This week was just crazy. It kind of threw me for a loop. This was a busy week. And I'm happy to know that I can still lose weight when things are thrown my way and it's a busy week. So that in a nutshell is how everything went for me this week. And I'm excited to go camping and for a successful week and second weigh in for the month of June. So I want to hear how you guys are doing. How was your week? Did you gain? Did you lose? Was it what you expected? What's your thought on this unhealthy thoughts that we put into our head? Do you find yourself in the same boat that I am? Where are you all or nothing? Are you tell yourself unhealthy thoughts when it comes to making mistakes on your journey? This really, really resonated with me. And like I said, I'm sorry for all the truth bombs, but I want to be honest and transparent with you guys. And this is actually something I do struggle with in my weight watchers journey. And like I said, in my life in general. So I like this topic and it really just kind of puts it back in the forefront of my mind, which is really, really helpful. So thank you guys so much for hanging out with me today. I hope you have a great Friday. If you're new, I'd love for you to stick around and join my channel. Hit that little subscribe button and that bell so you're notified when new videos are uploaded. I do away in every Friday and I do upload most other days of the week. Make sure you're checking out yesterday's calories video. Give this one a thumbs up if you love the way in. And of course I'll see you guys all in the next video. Have a fantastic weekend and I'll see you actually in tomorrow's massive and I mean massive grocery haul. See you guys then. Bye.


Hello and welcome back. In this lecture we are going to continue our discussion of conditional execution of statements in C++ programs. Here is a quick recap of some of the topics we have already seen earlier. We have seen the structure of a simple C++ program, how variables and their types are declared. We have seen the usage of assignment statements and arithmetic and logical expressions in assignment statements. We have discussed how statements are executed sequentially in a program and we have also looked at the usage of if else statements to do to achieve conditional execution of statements in a program. In this lecture we are going to look at conditional execution of statements using a new kind of statement called the switch case statement in C++ programs. And we are also going to look at conditional expressions. These are new kinds of expressions which can be evaluated conditionally. We are going to look at how they are written and how they are used in C++ programs. Now here are some useful facts that we already know. A program is nothing but a sequence of compiler directives, declarations and instructions. Normally the computer executes instructions in the same order in which the instructions appear in the program. However, we have seen that if else statements can be used to allow the computer to conditionally execute instructions not necessarily in a linear order. Now here is a simple programming problem. Several of you may be aware of the fortune program that is available in Unix and Linux based systems. Basically every time you run this program, it prints on the screen one of several predetermined anecdotes or messages. Suppose we want to implement a simple version of the fortune program. So what does the simple version do? It reads the date and time as integers from the user and then depending on the date and time it outputs one of only three predetermined fortune messages. So how do we go about solving this problem? Here is a simple flow chart that one can come up with for implementing a simple fortune program. So in this flow chart we first read inputs date and time. Let us say we read these as integers. Then we compute hash which is another integer as a function of date and time such that as we change date and time the value of hash changes but in any case the value of hash always stays within 0, 1, 2. So clearly this is a many to one function and specifically we are going to look at hash functions in more detail later in the course. But for the time being let us just assume that this is just a function of date and time which takes on values in the set 0, 1, 2. So once I have computed this hash value I can then check where the value of hash is 0. If yes I can print out the first fortune message, if no then I can check where the value of hash is 1. If the value of hash is indeed 1 I can print out the second fortune message. If the value of hash is neither 0 nor 1 then I print out the third fortune message and in all cases after printing out the message I return control back to the caller. So here is a simple animation of what might happen if the value of hash is 1. So as you saw the red circle which denotes the flow of control came down this side and then went this side, printed fortune message 2 and then returned control back to the caller. Here is how we might want to write a C++ program that implements the same flow chart. Here we have three integer variables and then we print out this message asking for the date in date month year format and the time in hour and minutes format. We read date and time as integers and then we compute a value between 0 and 2 using the values of date and time and this is just a simple way of computing this value. This is not a very sophisticated way of computing a value in 0, 1, 2 from date and time but this suffices for our purposes. Now why does this expression always evaluate to a value in 0, 1, 2 because I am computing the remainder on division by 3 and certainly on dividing by 3 the remainder will be 1 of 0, 1 or 2 and then I am checking if the value of hash is 0 then I am going to print out the first message. Let us say our first message is time and tide wait for none. If the value of hash is not 0 then I am going to check if its value is 1. If so I will print out the second message and let us say that the second message in our case is the pen is mightier than the sword and if the value of hash is neither 0 or 1 if it is indeed 2 then we will print out the message where there is a will there is a way. So what you see in this highlighted part is that we basically have nested if else statements and of course after executing this we execute return 0 and return control back to the operating system. Now in C plus plus if I were to write the same program but if I had 10 fortune messages to be printed out then I would have a very deeply nested if sequence of if else statements over here the nesting depth would be 10. I would have to write one if else statement and then inside that another one and then inside that another one and I have to continue that nesting for up to a depth of 10. While that would be a legitimate C plus plus program it is not the most convenient to write neither is it the most convenient to read. So therefore C plus plus basically provides an alternative to deeply nested if else statements. The point to note is that this alternative applies only when all conditions are of a particular form all the conditions in these nested if then else statements are of a particular form specifically they must check whether the same integer expression is equal to different constants. So pictorially this is how it looks like if the nested if then else in all the condition checks it is using the same integer expression and the condition checks are just checking whether that same expression is equal to one constant or the other then such a nested if then else structure can be replaced by an alternative statement in C plus plus which is called a switch case statement. So I want to highlight here that all these expressions are the same integer expression and all these comparisons are equality comparisons with integer constants. Now what does a switch case statement look like here is how it looks like here is our program fragment where we were printing one of three different messages depending on the value of hash I could write the same flow of control I could express the same flow of control using switch case statements as is shown here I am going to explain the different parts of the switch case statement but to begin with let us note that the switch case break and default are C plus plus keywords. The way the switch case statement is written is that the integer expression whose value I was comparing to different constants that integer expression in this particular case the integer variable hash is put as an argument of switch. So we say switch hash basically to denote that if the value of hash is equal to something and what is that something we write it as different cases. So switch hash case 0 is basically saying if hash is equal to 0 then you execute the statement and then we execute this new kind of statement called break I will explain what this means but for the time being let us just ignore it. Similarly if I look at case 1 so switch hash case 1 is basically checking if hash is equal to 1 and if so it is going to print out the next message let us ignore this break for the time being and then finally the default is saying that if the value of hash did not match any of these then this is the default message to be printed out. Now what are those break statements that we saw in the switch case statement what would happen if I did not put any break statements. So let us do that so here was our switch case statement with two breaks over here let us just delete those breaks and suppose I have now reached this point of the program as I am executing it and let us say the value of hash is 0 how would control flow through the program. The computer would first execute this statement denoted by this running icon the value of hash is 0 so it will go and execute whatever the executable statement for case 0 is so it will execute this statement print out the first message after that in the absence of the break statement it will just fall through to the next executable statement even if that statement corresponds to a different case. So it will just execute the next statement and once again it does not see any break so it will simply fall through to the next executable statement even if that corresponds to the default or a different case so it will execute that so basically it will print all three messages in this case and then it will execute return 0 and return control back to the operating system. So this is what is also known as fall through of control and in order to see how fall through of control works in a little bit more detail let us insert some of the break statements that we removed but not all of them so let us say I just introduced this break statement and now the value of hash is again 0 at this point of execution of the program. So the computer executes this statement then it executes this statement because the value of hash is 0 there is no break so it executes this statement after that it executes break and when it executes break it jumps out of the switch case and executes the last return statement. What would happen if the value of hash was 1 so the computer would execute this find that the value of hash is 1 so it will not execute this statement the statement for case 0 it will directly jump the statement for case 1 and it will continue execution from there subsequently until it sees a break statement or until it sees the end of the switch case statement so in this particular case it will see the break statement and jump out. So the point to note here is that depending on the value of hash the starting point for execution of my statements is defined after that it will continue to execute all statements sequentially until it sees a break at which point it can jump out of the loop or until it sees the end of the switch case statement. Now fall through as we have seen can also be used intentionally to serve some of our purposes so suppose I want all the fortune messages to be printed if the value of hash is 0 only two of them to be printed if the value of hash is 1 and only one if the value of hash is 2. So this was our original program in which case depending on the value of hash only one message would get printed but then if I just remove these two break statements we have just seen that if the value of hash is 0 it will print all three because of fall through if the value of hash is 1 it will print these two because of fall through and otherwise it will print this as the default statement. So the default in switch case statement is really similar to the final else branch in nested if else statements if the value of hash in our example does not match any of the case values then the default statements are executed. So that would be the case here if the value of hash is 2 the default statement would be executed. So now we have seen how statements can be executed conditionally in C++ programs it is also appropriate to look at this point expressions that can evaluate conditionally in C++ programs. So what are conditional expressions these are built on top of standard arithmetic expressions like a plus b star c or a plus b divided by c and suppose I wanted to do the following I want the same expression to take on the value of a plus b star c if a particular condition holds and to take on the value of a plus b divided by c otherwise. So the point to note it is the same expression should either have this value or have this value. Now simple way to do this is to write an if else statement. So if c is less than or equal to 0 that was our condition here then expression is a plus b star c otherwise expression is a plus b divided by c. While this is fine C++ provides an alternative way to do this we can write a single assignment statement on the left hand side of the assignment we have expression the variable to which we want to assign and on the right hand side we have this thing highlighted in red which is called a conditional expression. A conditional expression has 3 parts the first part is a condition followed by a question mark just like what we had in the if condition the second part is an expression that would appear in the true branch of the if else statement and the third part is the expression as it would appear in the else branch of the if else statement and these two expressions the one that appears in the true branch and in the false branch are separated by a colon. Now in general conditional expressions look like this there is a logical expression question mark if expression colon else expression the if expression and else expression must be of the same type and that will be the same as the type of the overall conditional expression.  So in summary in this lecture we looked at conditional execution of statements in C++ programs, we looked at switch case, we looked at the usage of breaks and fall throughs, we also looked at the default construct and we also saw how conditional expressions can be written in C++. Thank you.


Hi everyone, Joe for Jaspy's casebreaks.com coming at you with another random number block randomizer that unlocks Diamond icons one box pick your team number four brand new release just dropped today a lot of great teams Involved in here. That's how the number blocks work. If you're not familiar with it number zero gets any and all redemptions big Thanks to this group for making it happen. I appreciate it and there are the numbers right there Let's roll it. Let's randomize names and numbers three and a six nine times one two three four five six seven Eight and a ninth in final time after nine We got Steve down a steep three and a six nine times for the numbers one two three four five six seven Eight and good luck ninth and final time after nine. We got two down to six And here's how it shakes out for everybody Steve You've got two and seven Billy with three Dale with eight Sean with zero So you'll get any and all redemptions for that group of teams down there Including one of one redemption Steve Burch. You'll still get live one of ones You'll also have nine and four Billy with five Steve with six So sort numerically by number in That order right there and we'll see in the next video for the break jazzy's case breaks calm