Home > katas > Multiply Dart (8kyu)

Multiply Dart (8kyu)

Let's start with Multiply kata. I have to solve this one when I signed up for the Codewars account. It is some kind of validation, I guess.

Chek kata on Codewars


The code does not execute properly. Try to figure out why.

We start with this code:

int multiply(int a int b){
  return a * b

We can solve it just by adding the , between int a and int b, and adding ; after return statment

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

Or we can do oneliner.

int multiply(int a, int b) => a * b;

Let's check others solutions.

Some people omit types to make solution shorter.

var multiply = (a,b) => a*b;

Personally speaking, I wouldn't do it.

© 2021, Andrew Losseff