Skip to content

Instantly share code, notes, and snippets.

@arialdomartini
Created November 6, 2017 16:55
Show Gist options
  • Save arialdomartini/62d48191bd2c1c9fcaf4707c2a2e05f2 to your computer and use it in GitHub Desktop.
Save arialdomartini/62d48191bd2c1c9fcaf4707c2a2e05f2 to your computer and use it in GitHub Desktop.
guido-was-right.java
public class Exercise2 {
public static void main(String[] args) {
int nums[] = new int[]{1, 2, 42, 4, 5, 6};
boolean value = SecretOfLife.lookFor(nums);
System.out.println(value);
}
static class SecretOfLife {
public static boolean lookFor(int[] nums) {
double result = 0;
for (int i : nums) {
if (i == 42) {
System.out.println("Found!");
return true;}
}
return false;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment