Skip to content

Commit 3bb2bf8

Browse files
committed
add cast bool
1 parent 6eaf468 commit 3bb2bf8

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

107-Integers/integers.gop

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,16 @@
1010
// For int 20 values can also be expressed in hex (0x14), octal (0o24), and binary notation (0b0010100).
1111
// uint, there are no uint literals. All literal whole numbers are treated as int values.
1212
//
13-
// Go+ also supports writing numbers with _ as separator:
13+
// Go+ also supports writing numbers with _ as separator and also support cast bool to number types.
14+
// As example shows
1415

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

19+
println int(true) //Go+ support cast bool to int
20+
println float64(true) //and to float64
21+
println complex64(true) //and to complex64, and so on.
22+
1823
println 20+20
1924
println 20+30
2025
println 0x14 //in hex

0 commit comments

Comments
 (0)