Question: Your challenge is to take an array of strings and output the longest string in the array. So for

```
["tiny", "small", "bigger", "biggest"]

```

the output would be `biggest`.

If two elements of the array have the same length, you should choose the one that appears first in the array. That means if the array looks like this:

```
["one", "two", "no"]

```

the output is `one`, but if the array looked like this:

```
["two", "one", "no"]

```

the output is `two`.

---

As this is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), the shortest code in bytes wins.

Answer: 
[Swift](https://swift.org), 54 bytes
====================================

```swift
{($0 as[String]).reduce(""){$1.count>$0.count ?$1:$0}}

```

[Try it online!](https://tio.run/##Ky7PTCsx@V@WWKSQpmD7v1pDxUAhsTg6uKQoMy89VlOvKDWlNDlVQ0lJs1rFUC85vzSvxE7FAMJQsFcxtFIxqK39XwBUXaKRphGtBFRepKSjlJ9fAiRLEjNKlGI1Nf8DAA)
[Add++](https://github.com/cairdcoinheringaahing/AddPlusPlus), 7 bytes
======================================================================

```
L,bU«bL

```

[Try it online!](https://tio.run/##S0xJKSj4/99HJyn00Ookn/8qOYm5SSmJCoZ29lz@//9HK5WU5yvpKCjl56WCqMSkZBCVl68U@19Xt7QkDQA "Add++ – Try It Online")

More interesting, 32 byte version:

```
L,vbU§bLdbLBkÞ{g}@
D,g,@,bLBK=

```

[Try it online!](https://tio.run/##S0xJKSj4/99Hpywp9NDyJJ@UJB@n7MPzqtNrHbhcdNJ1HHSAAt62////j1YqKc9X0lFQys9LBVF5@UqxAA "Add++ – Try It Online")

How they work
-------------

```
L,	; Create a lambda function
	; Example argument:         		[["two" "one" "abc" "no"]]
    bU	; Evaluate as list; 			STACK = ['two' 'one' 'abc' 'no']
    «bL	; Take the value with the max length;	STACK = ['two']

```

And the 32 byte version:

```
L,		; Create a lambda function
		; Example argument: 		['["two" "one" "no"]']
	vbU	; Evaluate;		STACK = ['two' 'one' 'no']
	§bL	; Sort by length;	STACK = ['no' 'two' 'one']
	dbLBk	; Save length;		STACK = ['no' 'two' 'one']	REGISTER = 3
	Þ{g}	; Filter by 'g';	STACK = ['two' 'one']
	@	; Reverse;		STACK = ['one' 'two']
		; Implicitly return the top element:   'two'

D,g,@,		; Create a function 'g'
		; Example argument:		['two']
	bL	; Length;		STACK =	[3]
	BK=	; Equal to register;	STACK = [1]

```