Skip to content

A collection of programs that showcases basic functionalities in each programming language (that I know of)

License

Notifications You must be signed in to change notification settings

Abhiek187/coding-cheat-sheets

Repository files navigation

Coding Cheat Sheets

This is a collection of programs that showcases basic functionalities in each programming language (that I know of).

Core concepts include*:

  • Hello World
  • Variables (e.g., int, char, enums, structs, null)
  • Input/Output
  • Math Operations (e.g., +, -, *, /, %)
  • Logical Operators (e.g., and, or, not)
  • Conditional Operators (e.g., if, else)
  • Loops (e.g., while, for)
  • Pointers
  • Optionals
  • Functions
    • String Methods
    • Docstrings
    • Recursion
    • Generics
    • Operator Overloading
  • Arrays
    • Static & Dynamic Arrays
    • Array Methods
  • Dictionaries
  • Tuples
  • Sets
  • Exception Handling
  • Object-Oriented Programming (OOP)
    • Classes (constructors & destructors)
    • Encapsulation (access modifiers)
    • Inheritance (base & derived classes)
    • Abstraction (interfaces & abstract classes)
    • Polymorphism (virtual classes & functions)

*Note that not all languages support these features. And some languages like SQL operate using their own syntax.

When did you come up with the idea?

In 2018, I was learning Python and was bombarded with so much info about its syntax. To help me retain all the information, I created how_to_python.py, a culmination of all the basic Python syntax into one program. I was very proud of the end product that I considered doing something similar to other programming languages. However, I never committed to the idea until a few years later.

Python was a language I would utilize, but not regularly. So, to jog my memory, I would always refer back to how_to_python. One day when I was stuck at home, I looked back at that program and remembered just how useful it was to have a cheat sheet you could run. I had plenty of free time on my hand, so I finally decided to incorporate multiple languages into this long-overdue project.

How can I utilize this repo?

Each language is divided into folders, where each folder contains a separate README detailing the backstory of each language and how to run each file. From there, you can learn how each component of a language comes together. Note that this only covers the basics of a language. Please refer to the documentation or take a learning course to thoroughly learn a particular language.

Fun Facts

Note: Excluding CSS, HTML, JSON, Markdown, and SQL since they're not typical procedural languages

Compiled Languages

  • C
  • C#
  • C++
  • Dart (compiles ahead-of-time (AOT) for mobile and just-in-time (JIT) for web)
  • Go
  • Java (compiles to bytecode, then uses a JIT compiler at runtime)
  • Kotlin
  • Rust
  • Scala
  • Swift
  • TypeScript (compiles to JS)

Interpreted Languages

  • JavaScript
  • MATLAB
  • PHP
  • Python
  • Ruby
  • Shell

Languages that Require Semicolons

  • C
  • C#
  • C++
  • Dart
  • Java
  • MATLAB (to suppress output)
  • PHP
  • Rust

Languages that aren't Open-Source

  • MATLAB

Languages that Support Class-Based OOP

  • C#
  • C++
  • Dart
  • Java
  • Kotlin
  • MATLAB
  • PHP
  • Python
  • Ruby
  • Scala
  • Swift
  • TypeScript (JS classes are syntactic sugar for prototypes)

Languages that Support Multiple Inheritance

  • C++
  • MATLAB
  • Python

Languages with Destructors

  • C#
  • C++
  • PHP
  • Python
  • Rust
  • Swift

Statically Typed Languages

  • C
  • C#
  • C++
  • Dart
  • Go
  • Java
  • Kotlin
  • Rust
  • Scala
  • Swift
  • TypeScript (but can be dynamic like JS)

Dynamically Typed Languages

  • JavaScript
  • MATLAB
  • PHP
  • Python
  • Ruby
  • Shell

Languages with Pointers

  • C
  • C#
  • C++
  • Go
  • Rust

Languages that Require Manual Memory Management

  • C
  • C++

Languages that Don't Require break in Switch Statements

  • Go
  • Kotlin (when statements)
  • MATLAB
  • Ruby (case statements)
  • Rust (match statements)
  • Scala (match statements)
  • Swift

Languages with Null Safety

  • C#
  • Dart
  • Kotlin
  • Rust
  • Scala
  • Swift
  • TypeScript

Languages with // Comments

  • C
  • C#
  • C++
  • Dart
  • Go
  • Java
  • JavaScript
  • Kotlin
  • PHP
  • Rust
  • Scala
  • Swift
  • TypeScript

Languages with # Comments

  • PHP (less common)
  • Python
  • Ruby
  • Shell

Languages that Don't Support Multiline Comments

  • Python
  • Shell