Overview A type system is a logical framework that assigns a “type” (e.g., integer, string, boolean) to the various programs’ components. It is used by compilers and interpreters to ensure that operations are performed on compatible types, preventing a large class of runtime errors. Core Concepts Static vs. Dynamic Typing: Static Typing: Types are associated…
Overview Scope determines the visibility and lifetime of variables and functions in different parts of a program. It defines where an identifier can be accessed and where it is hidden from other parts of the code. Core Concepts Global Scope: Variables declared outside any function or block. They are accessible from anywhere in the program.…
Overview Recursion is a programming technique where a function calls itself to solve a problem. It is typically used to solve problems that can be broken down into smaller, identical sub-problems. Core Concepts Base Case: The condition under which the recursion stops. Without a base case, the function would call itself infinitely. Recursive Step: The…
Overview Loops are control flow structures that repeat a block of code as long as a specified condition is met. They are essential for processing collections of data or performing repetitive tasks without writing the same code multiple times. Core Concepts Iteration: A single pass through the loop’s body. Loop Types: For Loop: Best when…
Overview A function is a reusable block of code designed to perform a specific task. Functions allow programmers to break complex problems into smaller, manageable pieces, reducing redundancy and improving maintainability. Core Concepts Declaration vs. Expression: Declaration: A named function defined in the global or local scope. Expression: A function assigned to a variable (often…
Overview Error handling is the process of anticipating, detecting, and resolving anomalies (errors) that occur during the execution of a program. The goal is to prevent the application from crashing and to provide meaningful feedback to the user or developer. Core Concepts Exceptions: Events that disrupt the normal flow of instructions. Checked Exceptions: Errors that…
Overview Control flow refers to the order in which individual statements, instructions, or function calls are executed or evaluated. By default, code runs sequentially, but control flow structures allow the program to skip sections or repeat them based on conditions. Core Concepts Conditional Branching: Making decisions to execute different blocks of code. If/Else: The most…
Overview Data types are classifications that tell the compiler or interpreter how the programmer intends to use the data. They determine what values a variable can hold and what operations can be performed on that data. Core Concepts Primitive Types: The most basic data types built into a language. They are usually stored by value.…
Overview Boolean logic is a form of algebra centered around three main logical operators: AND, OR, and NOT. It is the fundamental building block of all digital computers, as it allows the CPU to make decisions based on binary values (true or false, 1 or 0). Core Concepts Boolean Values: Data that can only have…