The Best Beginner Language
Before discussing the best programming language overall, it’s easier to briefly consider the best beginner language.
A good choice would be Python, JavaScript, or Go.
Python is well suited to academic environments.
JavaScript is more suited to web development and is built into all web browsers.
Go is simple to learn, offers good performance, and compiles quickly. It has strict typing, which some people find confusing at first, but once you get to grips with it, it can simplify code and help prevent bugs.
That said, almost any popular language is a good starting point, provided it has solid support and plenty of tutorials.
The Best Language
There’s a quote by photographer Chase Jarvis that says, “The best camera is the one that’s with you.”
I think the same applies to programming, in the sense that “The best language is the one you have installed.” Though, of course, it’s not always that simple.
If you only have a couple of hours to write some code, it makes more sense to use a language you already know and have set up, rather than spending half a day configuring a new development environment and weeks learning a brand-new language.
But if you have a year to complete the project and it has specific requirements that another language would handle better, then taking the time to learn that language might be the smarter choice.
A simple browser-based game could be written in JavaScript, or in a language compiled to WebAssembly for better performance.
A web application that accesses a database will usually require server-side code. That server could use PHP for lightweight tasks. Alternatively it could use Go or any number of other languages. The code could be interpreted or compiled, depending on the use case.
For scientific or mathematical work, Python with specialised libraries may be the best fit.
For more intense operations, Zig or Odin might be more appropriate, especially if you want to take advantage of processor-level SIMD instructions. The same goes for intensive batch processing, where concurrent execution or multithreading can boost performance.
If you’re writing code just for fun then your favourite language, or the one you enjoy using the most, might be the best option.
In short, almost any language can be used to build the vast majority of projects. It really just depends on the particular circumstances and your existing knowledge.