@@ -91,57 +91,59 @@ pub fn main() {
9191 // When running on JavaScript runtimes ints are represented using JavaScript's
9292 // 64 bit floating point numbers.
9393
94+ // We can use `echo` to debug print a value.
95+
9496 // Int arithmetic
95- io.debug( 1 + 1)
96- io.debug( 5 - 1)
97- io.debug( 5 / 2)
98- io.debug( 3 * 3)
99- io.debug( 5 % 2)
97+ echo 1 + 1
98+ echo 5 - 1
99+ echo 5 / 2
100+ echo 3 * 3
101+ echo 5 % 2
100102
101103 // Int comparisons
102- io.debug( 2 > 1)
103- io.debug( 2 < 1)
104- io.debug( 2 >= 1)
105- io.debug( 2 <= 1)
104+ echo 2 > 1
105+ echo 2 < 1
106+ echo 2 >= 1
107+ echo 2 <= 1
106108
107109 // Equality works for any type and is checked structurally, meaning that two
108110 // values are equal if they have the same structure rather than if they are at
109111 // the same memory location.
110- io.debug( 1 == 1)
112+ echo 1 == 1
111113 // True
112- io.debug( 2 != 2)
114+ echo 2 != 2
113115 // False
114116
115117 // Standard library int functions
116- io.debug( int.min(142, 137) )
118+ echo int.min(142, 137)
117119 // 137
118- io.debug( int.clamp(-80, min: 0, max: 100) )
120+ echo int.clamp(-80, min: 0, max: 100)
119121 // 0
120- io.debug( int.base_parse("10", 2) )
122+ echo int.base_parse("10", 2)
121123 // Ok(2)
122124
123125 // Binary, octal, and hex Int literals
124- io.debug( 0b00001111)
125- io.debug( 0o17)
126- io.debug( 0xF)
126+ echo 0b00001111
127+ echo 0o17
128+ echo 0xF
127129
128130 // Use underscores to enhance integer readability
129- io.debug( 1_000_000)
131+ echo 1_000_000
130132
131133 // Gleam's numerical operators are not overloaded, so there are dedicated
132134 // operators for working with floats.
133135
134136 // Float arithmetic
135- io.debug( 1.0 +. 1.5)
136- io.debug( 5.0 -. 1.5)
137- io.debug( 5.0 /. 2.5)
138- io.debug( 3.0 *. 3.5)
137+ echo 1.0 +. 1.5
138+ echo 5.0 -. 1.5
139+ echo 5.0 /. 2.5
140+ echo 3.0 *. 3.5
139141
140142 // Float comparisons
141- io.debug( 2.2 >. 1.3)
142- io.debug( 2.2 <. 1.3)
143- io.debug( 2.2 >=. 1.3)
144- io.debug( 2.2 <=. 1.3)
143+ echo 2.2 >. 1.3
144+ echo 2.2 <. 1.3
145+ echo 2.2 >=. 1.3
146+ echo 2.2 <=. 1.3
145147
146148 // Floats are represented as 64-bit floating point numbers on both the Erlang
147149 // and JavaScript runtimes.
@@ -157,42 +159,41 @@ pub fn main() {
157159 // NaN or Infinity float value in the Erlang runtime.
158160
159161 // Division by zero is not an error
160- io.debug( 3.14 /. 0.0)
162+ echo 3.14 /. 0.0
161163 // 0.0
162164
163165 // Standard library float functions
164- io.debug( float.max(2.0, 9.5) )
166+ echo float.max(2.0, 9.5)
165167 // 9.5
166- io.debug( float.ceiling(5.4) )
168+ echo float.ceiling(5.4)
167169 // 6.0
168170
169171 // Underscores for floats are also supported
170- io.debug( 10_000.01)
172+ echo 10_000.01
171173
172174 // Division by zero will not overflow but is instead defined to be zero.
173175
174176 // Working with strings
175- io.debug("⭐ Gleam ⭐ - 별")
176- io.debug(
177- "this
177+ echo "⭐ Gleam ⭐ - 별"
178+ echo "this
178179 is
179180 a
180181 multi
181182 line
182- string",
183- )
184- io.debug( "\u{1F600}")
183+ string"
184+
185+ echo "\u{1F600}"
185186 // Outputs a smiley 😀
186187
187188 // Double quote can be escaped
188189 io.println("\"X\" marks the spot")
189190
190191 // String concatenation
191- io.debug( "One " <> "Two")
192+ echo "One " <> "Two"
192193
193194 // String functions
194- io.debug( text.reverse("1 2 3 4 5") )
195- io.debug( text.append("abc", "def") )
195+ echo text.reverse("1 2 3 4 5")
196+ echo text.append("abc", "def")
196197
197198 io.println(text.reverse("!desrever tog gnirts sihT"))
198199 // Outputs "This string got reversed!"
@@ -209,43 +210,43 @@ pub fn main() {
209210 // Bool operators
210211 // The || and && operators work by short-circuiting
211212
212- io.debug( True && False)
213+ echo True && False
213214 // False
214215
215- io.debug( True && True)
216+ echo True && True
216217 // True
217218
218- io.debug( False || False)
219+ echo False || False
219220 // False
220221
221- io.debug( False || True)
222+ echo False || True
222223 // True
223224
224225 // Bool functions
225- io.debug( bool.to_string(True) )
226+ echo bool.to_string(True)
226227 // "True"
227228
228- io.debug( bool.to_int(False) )
229+ echo bool.to_int(False)
229230 // 0
230231
231232 // Assignments
232233 let x = "Original value"
233- io.debug(x)
234+ echo x
234235
235236 // Assign `y` to the value of `x`
236237 let y = x
237- io.debug(y)
238+ echo y
238239
239240 // Assign `x` to a new value
240241 let x = "New value"
241- io.debug(x)
242+ echo x
242243
243244 // The `y` still refers to the original value
244- io.debug(y)
245+ echo y
245246
246247 // In Gleam variable and function names are written in snake_case.
247248 let answer_to_the_universe = 42
248- io.debug( answer_to_the_universe)
249+ echo answer_to_the_universe
249250
250251 let and_everything = answer_to_the_universe
251252 // Now using a variable produces a warning
0 commit comments