Answers for "function with arguments and *args"

3

function arguments

function createMenu({ title, body, buttonText, cancellable }) {
  // ...
}

createMenu({
  title: "Foo",
  body: "Bar",
  buttonText: "Baz",
  cancellable: true
});
Posted by: Guest on September-02-2021
0

Using *args to pass the variable-length arguments to the function

# Welcome to softhunt.net
def adder(*num):
    sum = 0
    
    for n in num:
        sum = sum + n

    print("Sum:",sum)

adder(5,8)
adder(6,7,8,9)
adder(11,12,13,14,15)
Posted by: Guest on April-15-2022

Code answers related to "function with arguments and *args"

Browse Popular Code Answers by Language