From the course: Visual Basic Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Use the And, Or logical operators

Use the And, Or logical operators - Visual Basic Tutorial

From the course: Visual Basic Essential Training

Start my 1-month free trial

Use the And, Or logical operators

- [Instructor] For this demonstration, we'll recreate the pizzeria logic challenge from earlier in this chapter with and logical operator and the or logical operator. The scenario is shown here. You get a free pizza at our pizzeria if today is Monday and it's three o'clock. Later we'll do the same logic test but with the or operator. And the way I've implemented this is I have two text boxes on this window. Here you type in the day of the week and here you type in the time and you click on the and button and if this is successful, you get a picture of a pizza and if it's not successful, like this, you get a coupon for a pizza the next time you visit our shop. This is how I've implemented the code. On line eight I have an if statement that says if the text in the text box is equal to Monday, then show the pictures and output this text here at the bottom of the screen. I'm only looking for the word Monday, so if…

Contents