Variable size/Get: Difference between revisions

add RPL
(add RPL)
 
(2 intermediate revisions by one other user not shown)
Line 758:
 
=={{header|Java}}==
<syntaxhighlight lang="java">
 
public final class VariableSize {
 
Line 774 ⟶ 773:
}
</syntaxhighlight>
{{ out }}
<pre>
A Byte variable occupies: 1 byte
A Char variable occupies: 2 bytes
A Short variable occupies: 2 bytes
A Float variable occupies: 4 bytes
An Integer variable occupies: 4 bytes
A Double variable occupies: 8 bytes
A Long variable occupies: 8 bytes
</pre>
 
=={{header|Julia}}==
Line 1,246 ⟶ 1,255:
Size of list4 is : 7
Size of list5 is : 5
</pre>
 
=={{header|RPL}}==
Introduced only in 2003, the <code>BYTES</code> command returns both the checksum and the size of an object. Before, Hewlett-Packard provided a table in the user manual to do the math by yourself. Size can be not an integer, as objects are made of nibbles.
{{Works with|HP|49}}
« BYTES NIP » '<span style="color:blue">OBJSIZE</span>' STO
 
42 <span style="color:blue">OBJSIZE</span>
{ 1 2 3 "FOUR" (5,6) [7 8] } <span style="color:blue">OBJSIZE</span>
« BYTES NIP » <span style="color:blue">OBJSIZE</span>
{{out}}
<pre>
3: 6.5
2: 50
1: 20.5
</pre>
 
1,150

edits