Skip to content

Latest commit

 

History

History
50 lines (32 loc) · 1.71 KB

Java Fundmentals - Control Flow.md

File metadata and controls

50 lines (32 loc) · 1.71 KB

Java Fundmentals - Control Flow

  • download - OctoTree onto Firefox

Control Flow:

* Block Scope
* Conditional Statements
* Loops
* Switch Statements
  • Control Flow - Java, like any programming language, supports both conditional statements and loops to determine control flow

  • Block Scope -Before learning control structures - block or compound statement consists of a Java statments. Blocks defined the scope of variables - blocks can be nested

    • public static void main(String[] args) - Class scope
    • anything inside of {} - all scope within the method scope is valid.
    • You may not declare identically named variables that is in the outer scope
  • Declaration brings the code forward

    • When declaring the variable, be more specific to the situation instead of x or y, etc
  • Conditional Statements - conditional statement

    • if(condition) statement
      Negate - the false statement for printing w/ !
  • if/else statement - else is not required to be coupled with if

    • to use else clause, it must be coupled with a prexisiting if clause
    • to use an if clause, you do not need a pre-exisiting else clause
  • if/else if statement -

    • else clause (otherwise) cannot come before else if, and can only after the else if clause
  • While() clause - will run infinity unless conditioned otherwise

Zen of Python - good guidelines for good/bad coding * be explicitwith coding

  • Integer = nothing vs. int = 0

    • enter your age code - practice writing it
  • DeterminateForLoop - you can type out fori in Intellij

  • Nested Loop - performs identically to a determinateWhileLoop

  • Method Loops - columns and rows

  • Multiple Selections - The Switch Statement

    • need to be defined absolute not && or <=