teaching machines

CS 145 Lecture 16 – Shortcircuiting and Truthtables

October 8, 2014 by . Filed under cs145, fall 2014, lectures.

Agenda

TODO

Code

Trick.java

package lecture1008;

public class Trick {
  public static boolean getTrue() {
    System.out.print("t");
    return true;
  }
  
  public static boolean getFalse() {
    System.out.print("f");
    return false;
  }
  
  public static void main(String[] args) {
    boolean trash = getFalse() || getFalse();
  }
}

CheckT.java

package lecture1008;

public class CheckT {
  public static void main(String[] args) {
    String s = "letter";
    
    System.out.println(s.length() > 3 && s.charAt(2) == 't');
  }
}

Haiku

on false dichotomies:
The two roads diverged
Completionist me took both
There was a save point