Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The <code>=</code> operator is perfectly correct; it’s the rest of your <code>Or</code> operands that are wrong!</p> <p>This is a pretty common mistake that people make in every language, and the fact of the matter is, it just doesn’t work. Programming languages aren’t magic. <code>Or</code> takes one operand and another and returns either a boolean or an integer. It has a lower precedence than <code>=</code>. You have to specify the comparison each time, or it’ll just always be <code>True</code>.</p> <pre><code>Console.WriteLine("Is there a 2nd IIS Server? (y/n)") Dim line As String = Console.ReadLine() If line = "Yes" Or line = "yes" Or line = "Y" Or line = "y" Then Servers.IISsvr2 = Console.ReadLine() End If </code></pre> <p>Also, use <code>OrElse</code> to prevent unnecessary comparisons (it’s almost always what you want when the operands are boolean):</p> <pre><code>Console.WriteLine("Is there a 2nd IIS Server? (y/n)") Dim line As String = Console.ReadLine() If line = "Yes" OrElse line = "yes" OrElse line = "Y" OrElse line = "y" Then Servers.IISsvr2 = Console.ReadLine() End If </code></pre> <p><code>Select Case</code> can also be fun in some cases<del>, but it’s probably not appropriate here</del>:</p> <pre><code>Select Case Console.ReadLine() Case "Yes", "yes", "Y", "y" Servers.IISsvr2 = Console.ReadLine() End Select </code></pre> <p>Prompts, anyone?</p> <pre><code>Function BooleanPrompt(prompt As String) As Boolean Do Console.Write("{0} (y/n) ", prompt) Select Case Console.ReadLine().ToLower() Case "y", "yes" Return True Case "n", "no" Return False End Select Loop End Function </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload