Implicit type conversion: Difference between revisions

(Added Java example)
Line 652:
 
For reference, jq's builtin types are "number", "boolean", "null", "object" and "array".
 
 
=={{header|Julia}}==
In general, Julia will promote a smaller sized datatype to a larger one when needed for a calculation involving mixed date types. Julia also accepts type annotations on variable declarations as shown below, though such type declarations are usually only allowed for variables that are declared within a function.
<lang julia>
julia> function testme()
ui8::UInt8 = 1
ui16::UInt16 = ui8
ui32::UInt32 = ui8
ui64::UInt64 = ui8
flo::Float64 = ui8
return ui8, sizeof(ui8), ui16, sizeof(ui16), ui32, sizeof(ui32), ui64, sizeof(ui64), flo, sizeof(flo)
end
testme (generic function with 1 method)
 
julia> testme()
(0x01, 1, 0x0001, 2, 0x00000001, 4, 0x0000000000000001, 8, 1.0, 8)
</lang>
 
=={{header|Kotlin}}==
4,103

edits