maTH
  • 👋Welcome!
  • 🗿Installation
  • Reference
    • 😱Mathematical operations
      • add
      • pascal
      • factorial
      • factorialL
      • GCD
      • LCM
      • pow
      • permutations
      • combinations
      • combinationsWithRep
      • subtract
      • multiply
      • divide
      • sin
      • cos
      • ln
      • log
      • radToDeg
      • degToRad
      • mod
      • abs
      • floor
      • ceil
      • root
      • exp
      • tan
      • arcsin
      • arccos
      • arctan
      • sinh
      • cosh
      • round
    • 🥶Statistics
      • Binomial
      • Poisson
      • Geometric
      • Pascal
      • Hypergeometric
      • Exponential
      • Uniform
    • 🥵Data structures
      • Stack
      • Queue
      • LinkedList
    • 🤓Algorithms
      • Bubble sort
      • Insertion sort
      • Selection sort
      • Merge sort
      • Quicksort
      • Heap sort
      • Count sort
      • Bucket sort
      • Radix sort
    • 😳Constants
Powered by GitBook
On this page
  1. Reference
  2. Mathematical operations

add

Add any two numbers together

add<return_type>(a, b);

will return the sum of the two given numbers together. The return_type specifies in which data type the sum will be returned in, like shown in below example:

add<int>(5, 15.1); //20
add<float>(0.2, 3); //3.2
add<bool>(-1, 200); //1
------------------------
add<char>('a', 1); //'b'
add<string>("abc", "abc"); //abcabc

Typically addition works only for numeric data types, but in this case, you have additional options for characters and strings. Before using it in that way, please test it before actually implementing something.

PreviousMathematical operationsNextpascal

Last updated 11 months ago

😱