lesson 5
This commit is contained in:
@@ -110,7 +110,7 @@ defmodule Numbers do
|
|||||||
end
|
end
|
||||||
|
|
||||||
koan "I want the first and last in the range" do
|
koan "I want the first and last in the range" do
|
||||||
first..last = Range.new(1, 10)
|
first..last//_ = Range.new(1, 10)
|
||||||
|
|
||||||
assert first == 1
|
assert first == 1
|
||||||
assert last == 10
|
assert last == 10
|
||||||
|
|||||||
@@ -5,15 +5,15 @@ defmodule Tuples do
|
|||||||
@intro "Tuples"
|
@intro "Tuples"
|
||||||
|
|
||||||
koan "Tuples can contain different things" do
|
koan "Tuples can contain different things" do
|
||||||
assert {:a, 1, "hi"} == ___
|
assert {:a, 1, "hi"} == {:a, 1, "hi"}
|
||||||
end
|
end
|
||||||
|
|
||||||
koan "Tuples have a size" do
|
koan "Tuples have a size" do
|
||||||
assert tuple_size({:a, :b, :c}) == ___
|
assert tuple_size({:a, :b, :c}) == 3
|
||||||
end
|
end
|
||||||
|
|
||||||
koan "You can pull out individual elements" do
|
koan "You can pull out individual elements" do
|
||||||
assert elem({:a, "hi"}, 1) == ___
|
assert elem({:a, "hi"}, 1) == "hi"
|
||||||
end
|
end
|
||||||
|
|
||||||
koan "You can change individual elements of a tuple" do
|
koan "You can change individual elements of a tuple" do
|
||||||
|
|||||||
Reference in New Issue
Block a user