Rosetta Code

Rosetta Code A+B

Add fixed integer pairs and return the resulting sums.

Intro View source
Source rosettacode/popular/a_b.vibe
# title: A+B
# source: https://rosettacode.org/wiki/A%2BB
# category: Rosetta Code
# difficulty: Intro
# summary: Add fixed integer pairs and return the resulting sums.
# tags: popular, math, basics, arithmetic
# vibe: 0.2

def add(a, b)
  a + b
end

def run
  [
    { left: 0, right: 0, sum: add(0, 0) },
    { left: 2, right: 3, sum: add(2, 3) },
    { left: -5, right: 12, sum: add(-5, 12) }
  ]
end
Output
Press run to execute run from this example.
rosetta-code popular math basics arithmetic browser-runner