Print Friendly, PDF & Email

Wich programming language is best to learn program?

Hello everyone! Often I see questions as wich programming language do you recommend me? Wich programming language is simpler? And many times we ask that because we don’t know exactly wich programming languages exist.

I think everyone learns in a unique way and that works for me not always will work for you, so I’m going to show you a very easy code on wich you may know how a multiplication of two numbers is done in several programming languages, and, even if it’s a trivial task, I’m pretty sure that may provide some hints to newcomers on wich learn, or specially note wich syntax can be more easily adopted.

All of these codes have been programmed by me, most of them were tested at codewars.com site.

Clojure

(ns multiply.bug.fix)
(defn multiply [a b]
 (* a b)
)

CoffeeScript

multiply =(a, b)->
  a * b

 

Crystal

def multiply(x, y)
  x * y
end

C

int multiply(int a, int b)
{
    return a * b;
}

 

C#

public class CustomMath {
    public static int multiply(int a, int b) {
        return a * b;
    }
}

Dart

int multiply(int a, int b){
  return a * b;
}

Elixir

defmodule Multiply do
  def multiply(a, b) do:
   a * b
end

Java

public class Multiply {
    public static Double multiply(final Double a, final Double b){         
        return (a == null || b == null) ?
                                          Double.NaN
                                          : 
                                          a * b;
    }
}

Javascript

var multiply = function (a, b) {
  return a * b;
}

PHP

function multiply($a, $b) {
  return $a * $b;
}

Python

def multiply(a, b):
  return a * b

Ruby

def multiply(a, b)
  a * b
end

Rust

fn multiply(a:i32, b:i32)  -> i32 {
  a * b
}

Typescript

export function multiply(a: number, b: number): number {
  return a * b;
}

Radio

Do NOT follow this link or you will be banned from the site!