tal
Q: my first hour, how to run in vscode?
just d/l and installed elixir (win auto installer) and added the elixirls extension to vscode.
vscode recognizes my hello.ex file as elixir.
how do I compile/run my single line hello world via the ide?
Most Liked
Sebb
running “Hello, World!” is the hardest part in learning Elixir. Its a little crazy. But as soon as that is out of the way, I promise, It’ll be a fun ride.
If you created your project with mix new Hello there is a module Hello in lib.
In there is a comment that tells you to run:
iex> Hello.hello()
:world
what it doesn’t tell you is, that you have to start iex in this way
iex -S mix
You can also run the function directly
mix run -e Hello.hello
but you should add something that you can see on the console first, like
def hello do
IO.puts("hello")
end
Note: If there are processes involved (later!) you’ll need to add --no-halt but then you’ll but build a Supervision-Tree (later!!) anyway (and you run an OTP-application and not just one function).
In the beginning I’d just put everything in tests and run
mix test
To run the test with a vscode-hotkey look here:
https://pragdave.me/blog/2018/06/13/visual-studio-code-elixir-tests.html
NobbZ
VScode is not an IDE, it tries to, but at the end it is “just” a smart editor.
Don’t try to rely on IDE features, learn to do things from the terminal.
mix is easy to use.
To run a single file script, just do elixir script.ex, its not how things usually are done though.







