Loop with a random












0














I made a little picker, it just says yes or not, but idk why it stucks in a loop i the While
Here is it:



Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Dim kk As Integer
kk = CInt(Int(Rnd() * 100) + 1)

While (kk <> 0 Or kk <> 1)
kk = kk / 2
End While

lblSiNo.Text = kk.ToString

End Sub


If it's 1, is a Yes, if it's 0, is No










share|improve this question



























    0














    I made a little picker, it just says yes or not, but idk why it stucks in a loop i the While
    Here is it:



    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
    Dim kk As Integer
    kk = CInt(Int(Rnd() * 100) + 1)

    While (kk <> 0 Or kk <> 1)
    kk = kk / 2
    End While

    lblSiNo.Text = kk.ToString

    End Sub


    If it's 1, is a Yes, if it's 0, is No










    share|improve this question

























      0












      0








      0







      I made a little picker, it just says yes or not, but idk why it stucks in a loop i the While
      Here is it:



      Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
      Dim kk As Integer
      kk = CInt(Int(Rnd() * 100) + 1)

      While (kk <> 0 Or kk <> 1)
      kk = kk / 2
      End While

      lblSiNo.Text = kk.ToString

      End Sub


      If it's 1, is a Yes, if it's 0, is No










      share|improve this question













      I made a little picker, it just says yes or not, but idk why it stucks in a loop i the While
      Here is it:



      Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
      Dim kk As Integer
      kk = CInt(Int(Rnd() * 100) + 1)

      While (kk <> 0 Or kk <> 1)
      kk = kk / 2
      End While

      lblSiNo.Text = kk.ToString

      End Sub


      If it's 1, is a Yes, if it's 0, is No







      infinite-loop






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Dec 28 '18 at 0:47









      Aaron Herrera

      81




      81
























          1 Answer
          1






          active

          oldest

          votes


















          0














          While (kk <> 0 Or kk <> 1)


          Every integer is different from 0 or 1, it can't be both equals to 1 and 0. Your predicate is always true.






          share|improve this answer























          • So the kk = kk/2 is doing nothing there?
            – Aaron Herrera
            Dec 28 '18 at 0:58










          • Your loop means "while kk is not 0 and 1 at the same time, divide kk by 2". This is a logical impossibility.
            – Calimero
            Dec 28 '18 at 1:04












          • Theres an Or, so how can i put an OR there?
            – Aaron Herrera
            Dec 28 '18 at 1:10












          • I have no idea what language you used, because you didn't tell us in your post, but usually <> means different. Try to replace it with the symbol for logical equality of this specific language if you want to stop your loop when kk equals 0 or 1 (also, kk is an integer and kk/2 may not be equal to a integer. I assume you are aware of this and know the consequence).
            – Calimero
            Dec 28 '18 at 1:14












          • Is Visual Basic
            – Aaron Herrera
            Dec 28 '18 at 1:15











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53952481%2floop-with-a-random%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          While (kk <> 0 Or kk <> 1)


          Every integer is different from 0 or 1, it can't be both equals to 1 and 0. Your predicate is always true.






          share|improve this answer























          • So the kk = kk/2 is doing nothing there?
            – Aaron Herrera
            Dec 28 '18 at 0:58










          • Your loop means "while kk is not 0 and 1 at the same time, divide kk by 2". This is a logical impossibility.
            – Calimero
            Dec 28 '18 at 1:04












          • Theres an Or, so how can i put an OR there?
            – Aaron Herrera
            Dec 28 '18 at 1:10












          • I have no idea what language you used, because you didn't tell us in your post, but usually <> means different. Try to replace it with the symbol for logical equality of this specific language if you want to stop your loop when kk equals 0 or 1 (also, kk is an integer and kk/2 may not be equal to a integer. I assume you are aware of this and know the consequence).
            – Calimero
            Dec 28 '18 at 1:14












          • Is Visual Basic
            – Aaron Herrera
            Dec 28 '18 at 1:15
















          0














          While (kk <> 0 Or kk <> 1)


          Every integer is different from 0 or 1, it can't be both equals to 1 and 0. Your predicate is always true.






          share|improve this answer























          • So the kk = kk/2 is doing nothing there?
            – Aaron Herrera
            Dec 28 '18 at 0:58










          • Your loop means "while kk is not 0 and 1 at the same time, divide kk by 2". This is a logical impossibility.
            – Calimero
            Dec 28 '18 at 1:04












          • Theres an Or, so how can i put an OR there?
            – Aaron Herrera
            Dec 28 '18 at 1:10












          • I have no idea what language you used, because you didn't tell us in your post, but usually <> means different. Try to replace it with the symbol for logical equality of this specific language if you want to stop your loop when kk equals 0 or 1 (also, kk is an integer and kk/2 may not be equal to a integer. I assume you are aware of this and know the consequence).
            – Calimero
            Dec 28 '18 at 1:14












          • Is Visual Basic
            – Aaron Herrera
            Dec 28 '18 at 1:15














          0












          0








          0






          While (kk <> 0 Or kk <> 1)


          Every integer is different from 0 or 1, it can't be both equals to 1 and 0. Your predicate is always true.






          share|improve this answer














          While (kk <> 0 Or kk <> 1)


          Every integer is different from 0 or 1, it can't be both equals to 1 and 0. Your predicate is always true.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Dec 28 '18 at 2:23

























          answered Dec 28 '18 at 0:53









          Calimero

          516




          516












          • So the kk = kk/2 is doing nothing there?
            – Aaron Herrera
            Dec 28 '18 at 0:58










          • Your loop means "while kk is not 0 and 1 at the same time, divide kk by 2". This is a logical impossibility.
            – Calimero
            Dec 28 '18 at 1:04












          • Theres an Or, so how can i put an OR there?
            – Aaron Herrera
            Dec 28 '18 at 1:10












          • I have no idea what language you used, because you didn't tell us in your post, but usually <> means different. Try to replace it with the symbol for logical equality of this specific language if you want to stop your loop when kk equals 0 or 1 (also, kk is an integer and kk/2 may not be equal to a integer. I assume you are aware of this and know the consequence).
            – Calimero
            Dec 28 '18 at 1:14












          • Is Visual Basic
            – Aaron Herrera
            Dec 28 '18 at 1:15


















          • So the kk = kk/2 is doing nothing there?
            – Aaron Herrera
            Dec 28 '18 at 0:58










          • Your loop means "while kk is not 0 and 1 at the same time, divide kk by 2". This is a logical impossibility.
            – Calimero
            Dec 28 '18 at 1:04












          • Theres an Or, so how can i put an OR there?
            – Aaron Herrera
            Dec 28 '18 at 1:10












          • I have no idea what language you used, because you didn't tell us in your post, but usually <> means different. Try to replace it with the symbol for logical equality of this specific language if you want to stop your loop when kk equals 0 or 1 (also, kk is an integer and kk/2 may not be equal to a integer. I assume you are aware of this and know the consequence).
            – Calimero
            Dec 28 '18 at 1:14












          • Is Visual Basic
            – Aaron Herrera
            Dec 28 '18 at 1:15
















          So the kk = kk/2 is doing nothing there?
          – Aaron Herrera
          Dec 28 '18 at 0:58




          So the kk = kk/2 is doing nothing there?
          – Aaron Herrera
          Dec 28 '18 at 0:58












          Your loop means "while kk is not 0 and 1 at the same time, divide kk by 2". This is a logical impossibility.
          – Calimero
          Dec 28 '18 at 1:04






          Your loop means "while kk is not 0 and 1 at the same time, divide kk by 2". This is a logical impossibility.
          – Calimero
          Dec 28 '18 at 1:04














          Theres an Or, so how can i put an OR there?
          – Aaron Herrera
          Dec 28 '18 at 1:10






          Theres an Or, so how can i put an OR there?
          – Aaron Herrera
          Dec 28 '18 at 1:10














          I have no idea what language you used, because you didn't tell us in your post, but usually <> means different. Try to replace it with the symbol for logical equality of this specific language if you want to stop your loop when kk equals 0 or 1 (also, kk is an integer and kk/2 may not be equal to a integer. I assume you are aware of this and know the consequence).
          – Calimero
          Dec 28 '18 at 1:14






          I have no idea what language you used, because you didn't tell us in your post, but usually <> means different. Try to replace it with the symbol for logical equality of this specific language if you want to stop your loop when kk equals 0 or 1 (also, kk is an integer and kk/2 may not be equal to a integer. I assume you are aware of this and know the consequence).
          – Calimero
          Dec 28 '18 at 1:14














          Is Visual Basic
          – Aaron Herrera
          Dec 28 '18 at 1:15




          Is Visual Basic
          – Aaron Herrera
          Dec 28 '18 at 1:15


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53952481%2floop-with-a-random%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Monofisismo

          Angular Downloading a file using contenturl with Basic Authentication

          Olmecas