Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
22
Task/Variable-size-Get/Elixir/variable-size-get.elixir
Normal file
22
Task/Variable-size-Get/Elixir/variable-size-get.elixir
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
list = [1,2,3]
|
||||
IO.puts length(list) #=> 3
|
||||
|
||||
tuple = {1,2,3,4}
|
||||
IO.puts tuple_size(tuple) #=> 4
|
||||
|
||||
string = "Elixir"
|
||||
IO.puts String.length(string) #=> 6
|
||||
IO.puts byte_size(string) #=> 6
|
||||
IO.puts bit_size(string) #=> 48
|
||||
|
||||
utf8 = "○×△"
|
||||
IO.puts String.length(utf8) #=> 3
|
||||
IO.puts byte_size(utf8) #=> 8
|
||||
IO.puts bit_size(utf8) #=> 64
|
||||
|
||||
bitstring = <<3 :: 2>>
|
||||
IO.puts byte_size(bitstring) #=> 1
|
||||
IO.puts bit_size(bitstring) #=> 2
|
||||
|
||||
map = Map.new([{:b, 1}, {:a, 2}])
|
||||
IO.puts map_size(map) #=> 2
|
||||
Loading…
Add table
Add a link
Reference in a new issue