Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!

Idiom #260 Create an empty list of strings

Declare a new list items of string elements, containing zero elements

#include <vector>
#include <string>
std::vector<std::string> items;
using System.Linq;
var items = Enumerable.Empty<string>();
using System.Collections.Generic;
var items = new List<string>();
var items = <String>[];
List<String> items = [];
character(len=:), allocatable, dimension(:) :: items
allocate (items(0),source="")
var items []string
var :: [String]
var = []
let items = [];
import java.util.*;
List<String> list = new ArrayList<>();
uses classes;
items := TStringList.Create;
my @items;
# or
my @items = ();
items = []
items = []
let items: Vec<String> = vec![];

New implementation...
< >
programming-idioms.org