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: 
[Java (OpenJDK 8)](http://openjdk.java.net/), 67 bytes
======================================================

Another submission in my favourite language! (read: the only one I know).  

This doesn't work with an empty array, but that's fine.

Golfed

```java
w->{for(String y:w)if(y.length()>w[0].length())w[0]=y;return w[0];}

```

Ungolfed

```java
for(String y:w)                           // Loops through all Strings
    if(y.length()>w[0].length())          // If the String is longer than the first String 
                                w[0]=y;   // Store it as the first string.
return w[0];                              // Return the first String.

```

[Try it online!](https://tio.run/##RY2xDsIgEEBn@IqLEySVONvoH@jiaBywpYgiNHC1aZp@O0LUON295O69u3zJte@Vu7eP1FgZIxykcTMlxqEKnWwUHGcKhJwwGKdBs89yvsDIa0oWSkk/XK1pIKLEPF7etPDMkv@l5FlI/hh0hB3I8@YiYm8NslW1KjJymiKqp/ADij4fo3XMCc3KA//VvpkjuOxI43o/dz58WzBtR246NgmrnMYb4/uxVH7EC@2mOigcgoNC9ZJITZeUVDuEynusUN7wDQ "Java (OpenJDK 8) – Try It Online")
[Kotlin](https://kotlinlang.org), 21 bytes
==========================================

```
{it.maxBy{it.length}}

```

[Try it online!](https://tio.run/##y84vycnM@59Wmqfgk1lcYhNcUpSZl26nl5Ofl55aXKKhqWD7PzexwqmyOrNELyc1L70koxasOjcxMw8oW82lAAQFQE0lGmAmCOQATfJP01DKz0tV0lFQKinPB1F5@UqacCUIC8BCmly1/wE "Kotlin – Try It Online")