Skip to content

Commit

Permalink
add cast bool
Browse files Browse the repository at this point in the history
  • Loading branch information
tsingbx committed Dec 12, 2023
1 parent 6eaf468 commit 3bb2bf8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion 107-Integers/integers.gop
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,16 @@
// For int 20 values can also be expressed in hex (0x14), octal (0o24), and binary notation (0b0010100).
// uint, there are no uint literals. All literal whole numbers are treated as int values.
//
// Go+ also supports writing numbers with _ as separator:
// Go+ also supports writing numbers with _ as separator and also support cast bool to number types.
// As example shows

num := 1_000_000 //Go+ support, same as 1000000
println num

println int(true) //Go+ support cast bool to int
println float64(true) //and to float64
println complex64(true) //and to complex64, and so on.

println 20+20
println 20+30
println 0x14 //in hex
Expand Down

0 comments on commit 3bb2bf8

Please sign in to comment.