HexLibraryHexLibrary
</> HexCodeSign inSign up
PythonJavaScriptTypeScriptCC++JavaPHPGoRustRubyBashSQLLuaPerlCOBOLPascalDelphiFortranDartSwiftC#JuliaGroovyRElixirHaskellKotlinScalaClassic ASPClipperMS-DOS
LESSONS
Introduction to GoVariablesData TypesOperatorsStringsArray & SliceMap (Dictionary)Conditions (if / switch)Loops (for)Functions
REFERENCE
📖 Overview
🖥️ Output
📦 Variables
🔢 Numbers & Math
✍️ String
📋 Array & Slice
slice [ ]append()
🗂️ Map
🔁 Condition & Loop
🧩 Function
Go›REFERENCE›Array & Slice›append()

append()

Appends an element to the slice.

Syntax

slice = append(slice, element)

Description

Appends the new element to the end and returns the RESULT — you must reassign it.

Example

Loading editor…

Expected output

[1 2 3]

When to use?

Growing lists.

Common mistakes

  • ⚠️ If the result of append is not reassigned, the addition is lost: s = append(s, x).

Related commands

slice [ ]
← slice [ ]
HexLibraryHexLibrary

Learn programming more clearly. Every command is explained line by line with colors, reinforced with runnable exercises, test your code instantly — all in one place, free.

Learn

  • Home
  • Languages & Lessons
  • HexCode

Company

  • About
  • Contact

Legal

  • Privacy Policy
  • Terms of Use

Other Projects

  • HexToolz
  • Free Service Manuals
© 2026 HexLibrary · The clearest way to learn code