Resources and reference

Quick syntax cheat sheets, a practical debugging guide, and project ideas to sharpen your skills. Everything here is real code you can run.

Home/Resources

On this page

Reference

Jump to a section below.

  1. Syntax cheat sheets
  2. Debugging guide
  3. Project ideas

Syntax cheat sheets

Compact, correct examples of the patterns you will use most. Copy a snippet into your editor and run it to confirm the behavior.

project/ src/ app.js utils.js node data tests/ app.test.js Each node is a file; arrows show related modules and dependencies.

Python: a conditional and a function

def classify(n): if n < 0: return "negative" elif n == 0: return "zero" return "positive" print(classify(7))

A function returns a value based on a condition chain. The final return is not guarded by an else, so it only runs when the earlier checks fail.

JavaScript: objects and destructuring

const user = { name: "Ada", age: 36 }; const { name, age } = user; const label = `${name} is ${age} years old`; console.log(label);

Destructuring copies named properties into local variables, and template literals build strings with embedded values in one readable line.

Java: a loop over an array

public class Total { public static void main(String[] args) { int[] nums = {3, 5, 7}; int sum = 0; for (int n : nums) { sum += n; } System.out.println(sum); } }

The enhanced for loop visits each element of the array in order. The block adds the current element to sum, printing 15 when the loop finishes.

C++: a vector and a range loop

#include <iostream> #include <vector> int main() { std::vector<int> v = {2, 4, 6}; for (int n : v) { std::cout << n << "\n"; } return 0; }

A vector is a resizable sequence, and the range loop prints each value on its own line. The include directives bring in input and output and the vector library.

Debugging guide

Most beginner errors come from a small set of habits. Here are the most common bugs we see and how to fix them.

Common bugs and fixes:

1. Off-by-one errors. A loop on range(len(a)) counts from zero, so the last valid index is len(a) - 1.

2. Comparing values instead of types. In JavaScript, == may coerce types; use === to compare value and type strictly.

3. Forgetting braces in Java and C++. Wrap every loop and condition body in curly braces to avoid single-statement surprises.

4. Shadowing or reusing a variable name. Rename the inner variable so it does not overwrite the outer value.

5. Reading input without checking it. Validate that a number was parsed before using it in a calculation.

Project ideas

Ten projects that build real skill. Start small and extend each one with a feature of your own.

  1. A command line calculator that supports addition, subtraction, multiplication, and division.
  2. A number guessing game that tells the player whether the guess is too high or too low.
  3. A to-do list that stores tasks in a file and reloads them on start.
  4. A unit converter for temperature, distance, and mass.
  5. A word counter that reads a text file and reports the most common words.
  6. A personal portfolio page built with semantic HTML and CSS.
  7. A quiz app that shows one question at a time and scores the answers.
  8. A simple blog page that renders posts from a JavaScript array.
  9. A grade tracker that computes averages and letter grades from student scores.
  10. A contact form with client side validation and a confirmation message.

Pick any idea, build the smallest working version first, then add error handling and styling. Shipping a small, working project beats an unfinished large one every time.