Skip to content

Commit 6937095

Browse files
authored
Add exercise: hello world (JuliaLang#13)
* Add exercise: hello world * hello-world: Remove unicode test & improve topics
1 parent 85b0b3b commit 6937095

File tree

4 files changed

+26
-0
lines changed

4 files changed

+26
-0
lines changed

config.json

+8
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@
55
"active": false,
66
"test_pattern": "TODO",
77
"exercises": [
8+
{
9+
"slug": "hello-world",
10+
"difficulty": 1,
11+
"topics": [
12+
"strings",
13+
"string interpolation"
14+
]
15+
},
816
{
917
"slug": "hamming",
1018
"difficulty": 1,

exercises/hello-world/example.jl

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
function hello(name::AbstractString="World")
2+
return "Hello, $(name)!"
3+
end

exercises/hello-world/hello-world.jl

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
function hello()
2+
3+
end

exercises/hello-world/runtests.jl

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using Base.Test
2+
3+
include("hello-world.jl")
4+
5+
@testset "no name" begin
6+
@test hello() == "Hello, World!"
7+
end
8+
9+
@testset "names" begin
10+
@test hello("Alice") == "Hello, Alice!"
11+
@test hello("Bob") == "Hello, Bob!"
12+
end

0 commit comments

Comments
 (0)