yorick banner

Home

Manual

Packages

Global Index

Keywords

Quick Reference

Back: Help Forward: Prompts   FastBack: Flow control Up: Environment FastForward: Arrays         Top: Yorick Contents: Table of Contents Index: Concept Index About: About this document

1.3.4 The info function

If you want to know the data type and dimensions of a variable, use the info function. Unlike help, which is intended to tell you what a thing means, info simply tells what a thing is.

 
> info, theta
 array(double,200)
> info, E
 array(double)

Here, double means "double precision floating point number", which is the default data type for any real number. The default integer data type is called long. (Both these names come from the C language, which gives them a precise meaning.)

Notice that the scalar value E is, somewhat confusingly, called an "array". In fact, a scalar is a special case of an array with zero dimensions. The info function is designed to print a Yorick expression which will create a variable of the same data type and shape as its argument. Thus, array(double,200) in an expression would evaluate to an array of 200 real numbers, while array(double) is a real scalar (the values are always zero).

Using info on a non-numeric quantity (a file object, a function, etc.) results in the same output as the print function. If an array of numbers might be large, try info before print.