Let’s start with Hello World

Now that we know how all things work together, let’s try our Hello World program in couple of ways.

The first and very simple way to impress people

import Html exposing (text)
main =
   text “Hello World!”

When you write front end application using Elm, you write everything in Elm including HTML. Will talk about it later. For now when you are in Elm you will everything in Elm except CSS.  Let’s look at the code above

import Html exposing (text)

We are importing the Html function sets and we are only exposing text function for this code to work.

main =
   text “Hello World!”

All Elm program starts with “main”, this is the entry for browser to know where to start. The main program executes text function which takes just one string parameter and create the DOM element for browser to render. This is the simple and easy to way to do it. But if you were following along you will notice, there is no model, view or update of any kind. Well that is because it is simple hello world program.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s