Variable size/Get: Difference between revisions

m (→‎{{header|Perl}}: revised to match current module usage)
Line 437:
2
</pre>
 
=={{header|Forth}}==
{{works with|ANS/ISO Forth}}
Forth is very close to the metal. Forth 94 standardized the size of an integer to be the native integer size of the CPU. Forth refers to this as a CELL. The defining word VARIABLE creates a variable that is one cell wide. The word CELLS takes an integer parameter and returns the number of bytes in one CELL.
<lang Forth>: .CELLSIZE ( -- ) CR 1 CELLS . ." Bytes" ;
VARIABLE X ( creates a variable 1 cell wide)</lang>
Test at the GNU Forth (32bit) console
<lang forth>.CELLSIZE
4 Bytes ok
-1 X ! ok
HEX X @ U. FFFFFFFF ok</Lang>
 
=={{header|Fortran}}==
Anonymous user