DEV Community

Divyanshu Shekhar
Divyanshu Shekhar

Posted on

1 1

Golang Variadic Arguments With Example

#go

Golang Variadic Arguments

Sometimes we don’t know how much parameters will be passed and then comes Variadic Parameters in Golang.

Condition for Variadic Argument:

  1. Variadic Arguments should only be one and must be placed at last.
  2. It is taken as Golang Slice, and Slice operations can be done on it.

Variadic Arguments Syntax

<parameter_name> …<type>

Learn more about Golang Variadic Arguments from the Original Post.

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs