-
Notifications
You must be signed in to change notification settings - Fork 3
/
exercises.toml
170 lines (135 loc) · 3.7 KB
/
exercises.toml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# intro
[[exercises]]
name = "intro1"
path = "exercises/intro/intro1.d"
hint = """Remove the 'Just D it' comment to move to the next exercise."""
type = "compile"
[[exercises]]
name = "intro2"
path = "exercises/intro/intro2.d"
hint = """
The format string expects something.
Add an argument inside the function."""
type = "compile"
# variables
[[exercises]]
name = "variables1"
path = "exercises/variables/variables1.d"
hint = """
When declaring variables, D needs a bit more information than just
an identifier. Try giving 'a' aditional information about what it is
and what it represents. Add the type before 'a'."""
type = "compile"
[[exercises]]
name = "variables2"
path = "exercises/variables/variables2.d"
hint = """
Unlike C or C++, all variables in D have predictable values when
initialized. This is because, by default, all variables are
initialized to their default initializer value. The int.init value
is '0'."""
type = "test"
[[exercises]]
name = "variables3"
path = "exercises/variables/variables3.d"
hint = """Add 'a = 4;' below the variable declaration."""
type = "test"
[[exercises]]
name = "variables4"
path = "exercises/variables/variables4.d"
hint = """
Variable 'a' is a constant value, so it cannot be modified. Remove
the assignment expression line."""
type = "compile"
# floating_point
[[exercises]]
name = "floating_point1"
path = "exercises/floating_point/floating_point1.d"
hint = """
Integer expressions cannot preserve the fractional part of a
result. Change the expected value '0.5' to '0'."""
type = "test"
[[exercises]]
name = "floating_point2"
path = "exercises/floating_point/floating_point2.d"
hint = """
The default initializer of floating point types is 'nan'. Arithmetic
operations with 'nan' always result in 'nan'. Initialize 'f' to any
numeric literal, e.g `float f = 0;`"""
type = "test"
[[exercises]]
name = "floating_point3"
path = "exercises/floating_point/floating_point3.d"
hint = """
Make use of the 'std.math' module. There you can find the 'isNan'
function and change the code to `assert(isNan(f));`"""
type = "compile"
[[exercises]]
name = "floating_point4"
path = "exercises/floating_point/floating_point4.d"
hint = """No hints this time ;)"""
type = "compile"
# functions
[[exercises]]
name = "functions1"
path = "exercises/functions/functions1.d"
hint = """Insert `a + b` after `return`."""
type = "compile"
[[exercises]]
name = "functions2"
path = "exercises/functions/functions2.d"
hint = """Insert the parameter `float a`, e.g `float half(float a)`"""
type = "compile"
[[exercises]]
name = "functions3"
path = "exercises/functions/functions3.d"
hint = """Insert the parameter `float a`, e.g `float half(float a)`"""
type = "compile"
[[exercises]]
name = "functions4"
path = "exercises/functions/functions4.d"
hint = """Create another function 'add' that receives 'float' types."""
type = "compile"
[[exercises]]
name = "functions5"
path = "exercises/functions/functions5.d"
hint = """
Modify the function signature to work with templated types.
`T multiply(T)(const T left, const T right)`"""
type = "compile"
# if
[[exercises]]
name = "if1"
path = "exercises/if/if1.d"
hint = """
Use an 'if' statement:
---
if (<condition>)
{
return <identifier>;
}
else
{
return <identifier>;
}
---
Note: The parentheses are optional in D for the `if` statement.
Note: without parenthesis only the first statement after `if` is
evaluated!"""
type = "test"
[[exercises]]
name = "if2"
path = "exercises/if/if2.d"
hint = """No hints this time ;)"""
type = "test"
[[exercises]]
name = "if3"
path = "exercises/if/if3.d"
hint = """Use the ternary operator, e.g `return a > b ? a : b;`"""
type = "test"
# quiz
[[exercises]]
name = "quiz1"
path = "exercises/quiz/quiz1.d"
hint = """No hints this time ;)"""
type = "test"