They are also known as numerical comparison operators. Normally they are used to compare two values to see whether they are equal or one value is greater or less than the other value. The comparison will return a true or false result.
These operators are shown in Table 9. Sometimes we might need to make more than one comparisons before a decision can be made. In this case, using numerical comparison operators alone is not sufficient, we need to use the logical operators. These logical operators are shown in Table 9. To effectively control the Visual Basic program flow, we shall use the If control structure together with the conditional operators and logical operators.
There are basically three types of If control structures, namely If…. Then statement, If…. Then… Else statement and If…. ElseIf statement. This is the simplest control structure which instructs the computer to perform a certain action specified by the Visual Basic expression if the condition is true. However, when the condition is false, no action will be performed. Nama Objek Enabled. Buat lah form seperti dibawah ini,lalu klik 2 kali pada button Proses lalu masukkan perintah pada gambar kedua dan setelah di Run akan menghasilkan tampilan program seperti gambar ketiga.
You are commenting using your WordPress. You are commenting using your Google account. You are commenting using your Twitter account. You are commenting using your Facebook account. Notify me of new comments via email. Notify me of new posts via email. October 15, November 5, Bentuk kondisi percabangan yang dapat ditemui antara lain : IF…. End IF IF ….
To control the Visual Basic program flow and to make decisions, we shall use the If control structure together with the conditional operators and logical operators. There are three types of If control structures, namely If…. Then statement, If…. Then… Else statement and If…. ElseIf statement. This control structure instructs the computer to perform a certain action specified by the Visual Basic expression if the condition is true. However, when the condition is false, no action will be performed.
The syntax for the if We write the code so that when the user runs the program and enter a number that is greater than or equal to 50 and less than , he or she will win a lucky prize. On the other hand, if the number entered is less than 50 or more than or equal to , the user will not win any prize.
This program involves the use of the If and then keywords, the conditional operators and the logical operators Or and And. As we can see in example Then statements to provide alternative outputs. However, there is a simpler way to provide alternative output, which is to use the If Else Statement.
This control structure will ask the computer to perform a certain action specified by the Visual Basic expression if the condition is met.
0コメント