0Pricing
Elixir & Phoenix: Scalable Backend Development · 课时

Elixir 语言简介

了解 Elixir 的设计理念、它与 Erlang/OTP 的关系,并设置开发环境。

Elixir 语言简介 是 CoddyKit 上的免费 Elixir & Phoenix: Scalable Backend Development 课时。 这是第 1 节课,共 4 节。 你可以在下方免费阅读本课时的完整内容 — 然后在浏览器中使用内置代码编辑器和全天候 AI 导师进行实践。 这是 Elixir & Phoenix: Scalable Backend Development 学习路径的一部分,你的进度在网页和 CoddyKit 应用中同步。 Elixir & Phoenix: Scalable Backend Development 课程共包含 4 节课。

本课时的部分内容尚未翻译,以英文显示。

Welcome to Elixir!

Elixir is a dynamic, functional language for scalable, maintainable apps. It runs on the battle-tested Erlang VM. Welcome aboard!

Why Choose Elixir?

You pick Elixir for effortless concurrency, fault tolerance that recovers gracefully, and a modern, productive syntax. Great for web, embedded, and real-time.

Erlang VM (BEAM) & OTP

Elixir runs on the Erlang VM (BEAM), famous for uptime, and uses OTP libraries to build fault-tolerant, distributed systems.

Getting Started: The Interactive Shell

The fastest way to play with Elixir is iex, its interactive shell. Just type iex in your terminal and start experimenting.

Your First Elixir Output

Time for Hello World. You print to the console with IO.puts — here it is inside a runnable module.

defmodule Greeter do
  def say_hello do
    IO.puts "Hello, CoddyKit!"
  end
end

Greeter.say_hello()

Basic Arithmetic

Elixir does arithmetic exactly as you would expect: add, subtract, multiply, divide. Run this to see basic math at work.

defmodule Calculator do
  def do_math do
    sum = 5 + 3
    product = 4 * 2
    IO.puts "Sum: #{sum}"
    IO.puts "Product: #{product}"
  end
end

Calculator.do_math()

Variables (Bindings) in Elixir

In Elixir, = binds a value to a variable. Variables are immutable — re-binding just creates a new binding, it never mutates the old value.

defmodule BindingsDemo do
  def show_bindings do
    name = "Elixir"
    IO.puts "First name: #{name}"

    # Re-binding 'name' creates a new binding
    name = "Phoenix"
    IO.puts "New name: #{name}"
    # The original "Elixir" value remains unchanged elsewhere
  end
end

BindingsDemo.show_bindings()

Atoms: Unique Constants

An atom is a constant whose value is its own name, written with a leading colon like :ok. Perfect as fast, clear identifiers and keys.

Elixir's Core Philosophy

Elixir is built on functional programming and concurrency — predictable code that easily runs many tasks at once across all your cores.

Quick Check: Elixir Foundations

Let's test your understanding of Elixir's core concepts.

Recap: Your Elixir Journey Begins!

You shipped your first Elixir skills: the BEAM and OTP, the iex shell, basic output and math, immutable bindings, and atoms. On to the good stuff!

常见问题解答

「Elixir 语言简介」课时是免费的吗?

是的 — 「Elixir 语言简介」的完整文本可在网页上免费阅读。要进行交互式练习(内置代码编辑器和全天候 AI 导师)并解锁 Elixir & Phoenix: Scalable Backend Development 课程的其余内容,请升级到 CoddyKit PRO。 Elixir & Phoenix: Scalable Backend Development 课程共包含 4 节课。

「Elixir 语言简介」这节课中我会学到什么?

了解 Elixir 的设计理念、它与 Erlang/OTP 的关系,并设置开发环境。 你通过在浏览器中直接运行的动手代码来练习 Elixir & Phoenix: Scalable Backend Development,全天候 AI 导师会在你学习这节课的过程中回答你的问题。

学习 Elixir & Phoenix: Scalable Backend Development 需要有经验吗?

无需任何先前经验。CoddyKit 上的 Elixir & Phoenix: Scalable Backend Development 课程适合初学者到高级学习者,你可以从这里开始或从头开始,按照自己的节奏学习。 这是第 1 节课,共 4 节。

「Elixir 语言简介」课时需要多长时间?

大多数 CoddyKit 课程大约需要 5–10 分钟。每节课都很精短且互动,所以你能稳步进步,并在网页和应用中从离开的地方继续。

我能在这节 Elixir & Phoenix: Scalable Backend Development 课中编写并运行代码吗?

能。每节 Elixir & Phoenix: Scalable Backend Development 课都包含内置代码编辑器,你可以在浏览器中直接编写并运行真实代码,并获得即时 AI 反馈 — 无需本地设置。

此课程中的所有课时

  1. Elixir 语言简介
  2. 基本数据类型与运算符
  3. 模式匹配与控制流
  4. Elixir 中的字符串、二进制数据与 sigil
← 返回 Elixir & Phoenix: Scalable Backend Development