# Functions and Conditions

In this chapter, we will discuss programming flow logic and various ways to organize your code. You will learn about functions, if-else, and switch statements.

Updated: November 16, 2026

## [Introduction to Functions](https://www.ask-codey.com/courses/java-full-stack-bootcamp/topics/introduction-to-functions)

1. [Introduction to Functions: an overview](https://www.ask-codey.com/lessons/introduction-to-functions-an-overview) (Novice): When you keep repeating the same lines of code, you can turn them into a function, one reusable block you call by name.
2. [Practice: The need for functions](https://www.ask-codey.com/lessons/introduction-to-functions-practice-the-need-for-functions) (Novice): Print the scores of five football teams by copying and pasting the same code, and see why repeated code is a problem.
3. [Organizing code into functions](https://www.ask-codey.com/lessons/introduction-to-functions-organizing-code-into-functions) (Apprentice): Learn the four parts of a function (name, parameters, return type and body), and how to call one and keep the value it returns.
4. [Practice: Creating Functions](https://www.ask-codey.com/lessons/introduction-to-functions-practice-creating-functions) (Apprentice): Replace the copied team-score code with one displayTeamScores function that takes each team's rank, name and scores as parameters.

## [Conditional Logic](https://www.ask-codey.com/courses/java-full-stack-bootcamp/topics/conditional-logic)

1. [If](https://www.ask-codey.com/lessons/conditional-logic-if) (Novice): Use if, if-else and if-else if-else to run a block of code only when a condition is true, or to pick one block out of several.
2. [Multiple Conditions](https://www.ask-codey.com/lessons/conditional-logic-multiple-conditions) (Apprentice): Combine conditions with && (and) and || (or), and use parentheses to group them so the if means what you intend.
3. [Switch](https://www.ask-codey.com/lessons/conditional-logic-switch) (Apprentice): The switch statement provides a more readable and efficient way to execute different code blocks based on the value of a single variable.
4. [Switch Expressions](https://www.ask-codey.com/lessons/conditional-logic-switch-expressions) (Apprentice): Java's arrow switch never falls through, lets one case match several values, and can give back a value you store in a variable, with no break to forget.

Source: https://www.ask-codey.com/courses/java-full-stack-bootcamp/chapters/functions-and-conditions
