Sum data type: Difference between revisions
add FreeBASIC
(add FreeBASIC) |
|||
Line 123:
"-17" >>value ! ok
"abc42" >>value ! error</lang>
=={{header|FreeBASIC}}==
These are called unions in FreeBASIC
<lang>type p2d
'a 2d point data type; used later to show unions can hold compound data types
x as integer
y as integer
end type
union foobar
'a union
small as ubyte
medium as integer
large as ulongint
end union
union thingo
'a FreeBASIC union can hold various data types:
text as string*8
num1 as double
num2 as ulongint
posi as p2d 'structs
union2 as foobar 'even another union!
end union</lang>
=={{header|Free Pascal}}==
|