TL;DR There are a few good options for the start like Python, JavaScript and HTML/CSS, but to find the best one for you, complete our test

When thinking about programming it is often hard to decide which language to start with. I saw a lot of answers to this question given randomly without considering the needs different people have.

Without the context, the best answer is it depends.

Some popular options include:

  • HTML & CSS
  • JavaScript
  • Python
  • C/C++
  • Java
  • PHP

So let’s examine them.

HTML & CSS

These two are not programming languages, but markup languages. They don’t contain features typical to programming languages such as conditional statements or loops. Their job is to let you define the logical structure (HTML) and look of a website (CSS).

A sample HTML snippet looks like this:

<!DOCTYPE html>
<html>
    <head>
        <link rel="stylesheet" type="text/css" href="mystyle.css">
    </head>
    <body>
        
        <h1>This is a heading</h1>
        <p>And this is a paragraph.</p>
    
    </body>
</html> 

and a sample CSS file linked to the HTML looks like this:

body {
  background-color: lightblue;
}

h1 {
  color: navy;
  margin-left: 20px;
}

Starting with HTML and CSS may be a good choice for the first language because it is fairly easy and lets you produce visible results quickly.

It may leave you hungry to learn the actual programming languages which is a good thing.

The downside is that you can only produce static pages this way and doing any meaningful calculations or user interaction will be extremely hard or impossible.

Good resources on HTML and CSS:

JavaScript

This language is mostly used to introduce dynamical features to websites like fetching data, handling user input and perform various calculations.

A sample JavaScript snippet looks like this:

function fibonacci(n) {
   return n < 1 ? 0
        : n <= 2 ? 1
        : fibonacci(n - 1) + fibonacci(n - 2);
}

alert(fibonacci(10));

You can paste this code into your browser console to try it!

A good resource on this: JS by Mozilla

This language will be a good choice for the start in general. Combining it with HTML and CSS will let you create dynamic websites. This is both fun and can easily let you get a job in IT.

Python

Python is a simple and expressive programming language that lets you achieve a lot in short time.

The areas where Python is used most often:

  • data science, machine learning and artificial intelligence
  • web development
  • automation of boring stuff

A sample Python script:

def get_fibonacci_number(n):
   if n <= 1:
       return n
   else:
       return(get_fibonacci_number(n-1) + get_fibonacci_number(n-2))

if __name__ == '__main__':
    print(get_fibonacci_number(10))

This language will be a good choice for the start in general. It lets you benefit from thousands of libraries written by other programmers.

It has great documentation.

You can learn the basics of Python in our platform

C/C++

These are two languages with simiar syntax. Nowadays C is used mostly to write drivers and control electronics. C++ is mostly used in game engines (like Unreal Engine) and competitive programming.

Sample C code

#include <stdio.h>
int main() {
    int n, i, sum = 0;

    printf("Enter a positive integer: ");
    scanf("%d", &n);

    for (i = 1; i <= n; ++i) {
        sum += i;
    }

    printf("Sum = %d", sum);
    return 0;
}

Sample C++ code shows that in simple examples it’s very similar to C.

#include <iostream>
using namespace std;

int main() {
    int n, i, sum = 0;

    cout << "Enter a positive integer: ";
    cin >> n;

    for (i = 1; i <= n; ++i) {
        sum += i;
    }

    cout << "Sum = " << sum;
    return 0;
}

You should be cautious starting with these languages.

You can build a lot of interesting low-level projects with them but the learning curve is pretty steep.

It takes long to become fluent in these languages and then it also takes long time to write code in them.

With these languages it may be too easy to get discouraged in the beginning.

A nice introduction to C can be found in a famous book by Kernighan and Ritchie

Java

Java is mostly used in corporate environment and mobile (android) application development. Although sometimes it is still recommended to beginners.

Java code looks like this

public class Fibonacci{

    public static int getFibonacciNumber(int n){
        if(n <= 1){
            return n;
        }else{
            return(getFibonacciNumber(n-1) + getFibonacciNumber(n-2));
        }
    }

    public static void main(String[] args) {
        System.out.print(getFibonacciNumber(10));
    }
}

The downside of this language is its verbosity and forced object-orientation. You may need to write a lot of code to achieve the desired result.

You should probably not start with this language unless you have a very specific goal in mind like:

  • getting a job the corporate/financial industry
  • building a native mobile applicaiton

PHP

The most widely supported language for hosting pages. This is the language that powers Wordpress - the most popular internet platform. This is also the language that Facebook was originally written in.

<?php
    function rec_fib($x) {
        if ($n < 2) {
            return $n;
        }
        return fib($n - 1) + fib($n - 2);
    }
    
    print_r(rec_fib(6));
?>

You should probably not start with this language unless you have a very specific goal in mind, such as:

  • extending your Wordpress page
  • preparing scripts that need to run on a server that only supports PHP

Summary

In general if you are a beginner and you want to start learning programming, you should probably start with one of the following languages:

  • HTML/CSS
  • JavaScript
  • Python

Because they let you produce visible results fast.

However, if you have different goals, the answer may be different for you.

To get a personalized recommendation complete this test. It should take you around 2 minutes.

Check out our programming app at https://codilingo.com