Previous episode: 03. Understand Booleans & Comparison Operators
Next episode: 05. Use Logical Operators
Get immediate access to this and 4,000+ other videos and books.
Take your career further with a Kodeco Personal Plan. With unlimited access to over 40+ books and
4,000+ professional videos in a single subscription, it's simply the best investment you can make in
your development career.
It's time to get started with your first Dart challenge. In this episode, you'll get two of them. So let's get started. For your first challenge I want you to create a variable called my age, and assign it your current age. Then create a constant called voting age. Set a boolean based on if your age is over the voting age. Pause the video now, and give it a shot. (gentle music) How'd that first challenge go for you? Let's go over it now. First start by creating a variable called my age. And then I need to check if my age is greater than, or equal to 18, the voting age. And with that, we have a boolean set, in the is voting age variable. How'd that one go? Don't worry if you didn't get it, I have another one for you. Create a constant called student, and set it to your name as a string. Then create a constant called author, and set it to Matt Galloway, the original author of these exercises. Finally, create a constant called author is student, that uses string equality to determine if the student and author are equal. Pause the video now and try it out. (gentle music) How'd that one go? Feel free to follow along with me. Okay, first I'll set up the student and author constants. And then to find out if the author and student have the same name. I'll use a double equal sign to check for equality. And then I'll print out the result. And that's it, as you can see, I am not Matt Galloway. Well, that's it for this challenge, next up, some more work with operators and booleans.
All videos. All books.
One low price.
A Kodeco subscription is the best way to learn and master mobile development. Learn iOS, Swift, Android, Kotlin, Flutter and Dart development and unlock our massive catalog of 50+ books and 4,000+ videos.