Fantom is a relatively new programming language, designed to be a general-purpose, high-performance, and cross-platform language. It was created in 2005 by Brian Frank and Andy Frank, and it is still being actively developed by the Fantom Foundation. This guide will provide an introduction to Fantom programming language, including how to write it, a simple example, and some of its best applications.

How to Write in Fantom:

Before writing in Fantom, it is essential to have a basic understanding of the language's syntax. Fantom is a statically typed language that uses indentation-based syntax, similar to Python. Here's an example of a "Hello, World!" program in Fantom:

```
class HelloWorld
{
  static Void main()
  {
    echo("Hello, World!")
  }
}
```

In this example, we defined a class called `HelloWorld`, which has a static method called `main`. The `echo` method is used to output the string "Hello, World!" to the console. Note that in Fantom, semicolons are not required to end a statement.

Best Applications for Fantom:

Fantom is designed to be a general-purpose language, which means it can be used for a variety of applications. One of its biggest advantages is its ability to create cross-platform applications. It can be used to develop applications for Windows, Linux, and macOS. Some of the best applications for Fantom include:

1. Web development: Fantom has built-in support for web development, including HTTP client and server libraries.

2. Scripting: Fantom can be used for scripting tasks, such as automated testing, system administration, and more.

3. Mobile development: Fantom can be used to develop mobile applications for iOS and Android.

4. Game development: Fantom can be used to develop games using the Unity game engine.

5. Data analysis: Fantom has libraries for data analysis, including support for machine learning and artificial intelligence.

Example Application:

Let's take a look at a simple example application written in Fantom. In this example, we'll write a program that calculates the average of a list of numbers:

```
class Average
{
  static Void main()
  {
    numbers := [1, 2, 3, 4, 5]
    total := 0
    foreach (num in numbers)
    {
      total += num
    }
    average := total / numbers.size
    echo("The average is: $average")
  }
}
```

In this example, we defined a class called `Average`, which has a static method called `main`. We defined a list of numbers, and then used a `foreach` loop to calculate the total of all the numbers in the list. We then divided the total by the size of the list to calculate the average, and outputted the result to the console.

Conclusion:

Fantom is a versatile and powerful programming language that has a lot of potential for a wide range of applications. Whether you're a beginner or an experienced programmer, Fantom is worth exploring. Hopefully, this guide has provided you with a good introduction to the language, and given you the tools you need to start writing your own programs in Fantom.