Creating a Scalar Data Type at Run-Time

QUESTION: I know I can use Make_Array to create an array of a particular data type at run-time, but I need a scalar value. Is there an equivalent method to do that? I have to read the scalar data value and the type of the data out of a file, and I don't know ahead of time which data type it will be.

ANSWER: It is extremely difficult to find this in the IDL documentation, but this can be accomplished with the Fix command, using the TYPE keyword. A scalar of any data type can be created. The type codes you use with the keyword are those specified and described for the IDL Size command.

Web Coyote's Guide to IDL Programming