waves_logo Docs
  • Ride Programming Language
    Ride Programming Language
  • Getting started
    Getting started
  • Base concepts
    • Definition
      Definition
    • Expression
      Expression
    Base concepts
  • Comments
    Comments
  • Constants
    Constants
  • Data types
    • Boolean
      Boolean
    • ByteVector
      ByteVector
    • Int
      Int
    • String
      String
    • Unit
      Unit
    • List
      List
    • Tuple
      Tuple
    • Union
      Union
    Data types
  • Exceptions
    Exceptions
  • Functions
    • Annotations
      Annotations
    • Built-in functions
      • Account data storage functions
        Account data storage functions
      • Blockchain functions
        Blockchain functions
      • Byte array functions
        Byte array functions
      • Converting functions
        Converting functions
      • Data transaction functions
        Data transaction functions
      • Decoding functions
        Decoding functions
      • Encoding functions
        Encoding functions
      • Exception functions
        Exception functions
      • Hashing functions
        Hashing functions
      • List functions
        List functions
      • Math functions
        Math functions
      • String functions
        String functions
      • Union functions
        Union functions
      • Verification functions
        Verification functions
      Built-in functions
    • Callable function
      Callable function
    • Verifier function
      Verifier function
    Functions
  • FOLD<N> Macro
    FOLD<N> Macro
  • Operators
    • match-case
      match-case
    Operators
  • Script
    • Directives
      Directives
    • Script body
      Script body
    • Script context
      Script context
    • Script types
      • Account script
        Account script
      • Asset script
        Asset script
      • dApp script
        dApp script
      Script types
    • Standard Library
      Standard Library
    Script
  • Structures
    • Script actions
      • BinaryEntry (v4)
        BinaryEntry (v4)
      • BooleanEntry (v4)
        BooleanEntry (v4)
      • Burn (v4)
        Burn (v4)
      • DataEntry (v3)
        DataEntry (v3)
      • DeleteEntry (v4)
        DeleteEntry (v4)
      • IntegerEntry (v4)
        IntegerEntry (v4)
      • Issue (v4)
        Issue (v4)
      • Reissue (v4)
        Reissue (v4)
      • ScriptTransfer (v3 and v4)
        ScriptTransfer (v3 and v4)
      • SponsorFee (v4)
        SponsorFee (v4)
      • StringEntry (v4)
        StringEntry (v4)
      Script actions
    • Script results (v3)
      • ScriptResult
        ScriptResult
      • TransferSet
        TransferSet
      • WriteSet
        WriteSet
      Script results (v3)
    • Common structures
      • Address
        Address
      • Alias
        Alias
      • Asset
        Asset
      • AssetPair
        AssetPair
      • AttachedPayment
        AttachedPayment
      • BalanceDetails
        BalanceDetails
      • BlockInfo
        BlockInfo
      • Invocation
        Invocation
      • Order
        Order
      • Transfer
        Transfer
      Common structures
    • Transaction structures
      • BurnTransaction
        BurnTransaction
      • CreateAliasTransaction
        CreateAliasTransaction
      • DataTransaction
        DataTransaction
      • ExchangeTransaction
        ExchangeTransaction
      • GenesisTransaction
        GenesisTransaction
      • InvokeScriptTransaction
        InvokeScriptTransaction
      • IssueTransaction
        IssueTransaction
      • LeaseCancelTransaction
        LeaseCancelTransaction
      • LeaseTransaction
        LeaseTransaction
      • MassTransferTransaction
        MassTransferTransaction
      • ReissueTransaction
        ReissueTransaction
      • SetAssetScriptTransaction
        SetAssetScriptTransaction
      • SetScriptTransaction
        SetScriptTransaction
      • SponsorFeeTransaction
        SponsorFeeTransaction
      • TransferTransaction
        TransferTransaction
      • UpdateAssetInfoTransaction
        UpdateAssetInfoTransaction
      Transaction structures
    Structures
  • Variables
    • Built-in variables
      Built-in variables
    Variables
  • Limitations
    • Complexity
      Complexity
    • Data Weight
      Data Weight
    Limitations
  • Ride Components
    Ride Components
  • Script performance tests
    Script performance tests
      • English
      • Русский
      On this page
        • List Operations
        • Example
      waves_logo Docs

          # List

          List is a list data type.

          The list may contain elements of various types, including nested lists.

          The maximim number of list items is 1000. The nesting depth is not limited. For weight restrictions, see the Data Weight article.

          # List Operations

          Lists support concatenation , as well as adding items to the beginning and the end.

          Operation Symbol Complexity
          Concatenation ++ 4
          Adding the element to the end of the list (the list is on the left, the element is on the right) :+ 1
          Adding the element to the beginning of the list (the element is on the left, the list is on the right) :: 2

          ⚠️ ++ and :+ operators are added in Standard library version 4 which becomes available after activation of feature #15 “Ride V4, VRF, Protobuf, Failed transactions” (currently on Stagenet only).

          # Example

          nil :+ 1 :+ 2 :+ 3
          

          Result: [1, 2, 3]

          1 :: 2 :: 3 :: nil
          

          Result: [1, 2, 3]

          let intList  = [1, 2]             # List[Int]
          let strList  = ["3", "4"]         # List[String]
          let joined   = intList ++ strList # List[Int|String]
          joined
          

          Result: [1, 2, "3", "4"]

          let appended = joined :+ true     # List[Boolean|Int|String]
          appended
          

          Result: [1, 2, "3", "4", true]

          let nested    = intList :: joined  # List[Int|List[Int]|String]
          nested
          

          Result: [[1, 2], 1, 2, "3", "4"]

          Unit
          Tuple
          Unit
          Tuple