Variable size/Set: Difference between revisions

(Scala solution added)
Line 292:
 
Here, v is specified to have a minimum size. In this case, the minimum size of the content is zero, though the size of the representation is somewhat larger.
 
=={{header|Julia}}==
<lang julia>types = [Int8, UInt8, Int16, UInt16, Int32, UInt32, Int64, UInt64]
 
for t in types
println("For type ", lpad(t,6), " size is $(sizeof(t)).")
end
 
primitive type MyInt24 24 end
 
println("For user defined type MyInt24, size is ", sizeof(MyInt24))
</lang> {{output}} <pre>
For type Int8 size is 1.
For type UInt8 size is 1.
For type Int16 size is 2.
For type UInt16 size is 2.
For type Int32 size is 4.
For type UInt32 size is 4.
For type Int64 size is 8.
For type UInt64 size is 8.
For user defined type MyInt24, size is 3
</pre>
 
=={{header|Kotlin}}==
4,103

edits