Skip to content

Commit

Permalink
fix examples with new echo precedence
Browse files Browse the repository at this point in the history
  • Loading branch information
giacomocavalieri committed Nov 21, 2024
1 parent 9fa6d02 commit 62b2777
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 33 deletions.
22 changes: 11 additions & 11 deletions src/content/chapter0_basics/lesson05_ints/code.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@ import gleam/int

pub fn main() {
// Int arithmetic
echo { 1 + 1 }
echo { 5 - 1 }
echo { 5 / 2 }
echo { 3 * 3 }
echo { 5 % 2 }
echo 1 + 1
echo 5 - 1
echo 5 / 2
echo 3 * 3
echo 5 % 2

// Int comparisons
echo { 2 > 1 }
echo { 2 < 1 }
echo { 2 >= 1 }
echo { 2 <= 1 }
echo 2 > 1
echo 2 < 1
echo 2 >= 1
echo 2 <= 1

// Equality works for any type
echo { 1 == 1 }
echo { 2 == 1 }
echo 1 == 1
echo 2 == 1

// Standard library int functions
echo int.max(42, 77)
Expand Down
22 changes: 11 additions & 11 deletions src/content/chapter0_basics/lesson06_floats/code.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@ import gleam/float

pub fn main() {
// Float arithmetic
echo { 1.0 +. 1.5 }
echo { 5.0 -. 1.5 }
echo { 5.0 /. 2.5 }
echo { 3.0 *. 3.5 }
echo 1.0 +. 1.5
echo 5.0 -. 1.5
echo 5.0 /. 2.5
echo 3.0 *. 3.5

// Float comparisons
echo { 2.2 >. 1.3 }
echo { 2.2 <. 1.3 }
echo { 2.2 >=. 1.3 }
echo { 2.2 <=. 1.3 }
echo 2.2 >. 1.3
echo 2.2 <. 1.3
echo 2.2 >=. 1.3
echo 2.2 <=. 1.3

// Equality works for any type
echo { 1.1 == 1.1 }
echo { 2.1 == 1.2 }
echo 1.1 == 1.1
echo 2.1 == 1.2

// Division by zero is not an error
echo { 3.14 /. 0.0 }
echo 3.14 /. 0.0

// Standard library float functions
echo float.max(2.0, 9.5)
Expand Down
4 changes: 2 additions & 2 deletions src/content/chapter0_basics/lesson08_equality/code.gleam
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub fn main() {
echo { 100 == 100 }
echo { 1.5 != 0.1 }
echo 100 == 100
echo 1.5 != 0.1
}
8 changes: 4 additions & 4 deletions src/content/chapter0_basics/lesson10_bools/code.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import gleam/bool

pub fn main() {
// Bool operators
echo { True && False }
echo { True && True }
echo { False || False }
echo { False || True }
echo True && False
echo True && True
echo False || False
echo False || True

// Bool functions
echo bool.to_string(True)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ pub fn main() {
let two: Int = 2

// UserId and Int are the same type
echo { one == two }
echo one == two
}
4 changes: 2 additions & 2 deletions src/content/chapter0_basics/lesson18_constants/code.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ const floats = [1.0, 2.0, 3.0]

pub fn main() {
echo ints
echo { ints == [1, 2, 3] }
echo ints == [1, 2, 3]

echo floats
echo { floats == [1.0, 2.0, 3.0] }
echo floats == [1.0, 2.0, 3.0]
}
2 changes: 1 addition & 1 deletion src/content/chapter3_data_types/lesson07_nil/code.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ pub fn main() {
// let y: List(String) = Nil

let result = io.println("Hello!")
echo { result == Nil }
echo result == Nil
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pub fn main() {
// 8 bit int. In binary: 00000011
echo <<3>>
echo { <<3>> == <<3:size(8)>> }
echo <<3>> == <<3:size(8)>>

// 16 bit int. In binary: 0001100000000011
echo <<6147:size(16)>>
Expand Down

0 comments on commit 62b2777

Please sign in to comment.