If statement not detecting boolean change : <p>Even though I changed the boolean, "root", the if statement uses the event that is supposed to find the square root of a number instead of doing the normal operations (addition, subtraction, etc.)</p>

<pre><code>    String piCheck = "pi";
    String rootCheck = "square root";
    Double n1 = null;
    boolean root = false;

    Scanner reader = new Scanner(System.in);

    System.out.println("Welcome to Calculator!");
    System.out.println(" ");

    System.out.println("Enter a number, ");
    System.out.println("or enter 'pi' to insert PI,");
    System.out.println("or enter 'square root' to find the square root of a number.");
    String input = reader.nextLine();
    if (input.toLowerCase().contains(piCheck)) {
        n1 = Math.PI;
        root = false;
    } else if (input.toLowerCase().contains(rootCheck)) {
        root = true;
    } else {
        n1 = Double.parseDouble(input);
        root=false;
    }

    if (root = true) {
        System.out.println("Which number would you like to find the square root of?");
        n1 = reader.nextDouble();
        System.out.println("The square root of " + n1 + " is:");
        System.out.println(Math.sqrt(n1));
    } else if (root != true) {
        Scanner reader2 = new Scanner(System.in);
        System.out.println("Would you like to multiply, divide, add, subtract?");
        String uOperation = reader2.nextLine();
</code></pre>
