? | ?? Command

Evaluates expressions and sends the results to the main Visual FoxPro window, an active user-defined window, or the printer.

? | ?? Expression1 [PICTURE cFormatCodes] | [FUNCTION cFormatCodes] | 
   [VnWidth] [AT nColumn] 
   [FONT cFontName [, nFontSize [, nFontCharSet]] [STYLE cFontStyle | Expression2]]
   [, Expression3] ... 

Parameters

  • ? Expression1
    Evaluates the expression specified by Expression1 and sends a carriage return and line feed preceding the expression results.

    The results display on the next line of the main Visual FoxPro window or the active user-defined window and are printed at the left margin of a page unless a function code specified by cFormatCodes or the _ALIGNMENT system variable specifies otherwise.

    If you omit the expressions, a blank line is displayed or printed. A space is placed between expression results when multiple expressions are included.

    If Expression1 is an object, the ? command returns the character string, "(Object)".

  • ?? Expression1
    Evaluates the expression specified by Expression1 and displays the expression results on the current line at the current position of the main Visual FoxPro window, an active user-defined window, or the printer. A carriage return and line feed are not sent before the results.

  • PICTURE cFormatCodes
    Specifies a picture format in which the result of Expression1 is displayed. cFormatCodes can consist of function codes, picture codes, or a combination of both. You can use the same codes available in the Format Property and InputMask Property.

    Function codes affect the overall format of the result; picture codes act on individual characters in the result. If function codes are used in cFormatCodes, they must appear before the picture codes and they must be preceded by an at (@) sign. Multiple function codes with no embedded spaces can immediately follow the @ sign. The last function code must be followed by one or more spaces. The space or spaces signal the end of the function codes and the start of the picture codes.

  • FUNCTION cFormatCodes
    Specifies a function code to include in the output from the ? and ?? commands. If the function clause is included, do not precede the function codes with an @ sign. Function codes must be preceded by a @ sign when included in PICTURE.

  • V nWidth
    Specifies a special function code that enables the results of a character expression to stretch vertically within a limited number of columns. nWidth specifies the number of columns in the output.

    ? 'This is an example of how the V function code works.' ;
       FUNCTION 'V10'
    
  • AT nColumn
    Specifies the column number where the output is displayed. This option makes it possible for you to align output in columns to create a table. The numeric expression nColumn can be a user-defined function that returns a numeric value.

  • FONT cFontName[, nFontSize [, nFontCharSet]]
    Specifies a font for output by the ? or ?? command. cFontName specifies the name of the font, and nFontSize specifies the point size. You can specify a language script with nFontCharSet. See the GETFONT( ) Function for a list of available language script values.

    For example, the following command displays the system date in 16-point Courier font:

    ? DATE( ) FONT 'Courier',16 
    

    If you include the FONT clause but omit the point size nFontSize, a 10-point font is used.

    If you omit the FONT clause, and output for the ? or ?? command is placed in the main Visual FoxPro window, the main Visual FoxPro window font is used for the output. If you omit the FONT clause, and output for the ? or ?? command is placed in a user-defined window, the user-defined window font is used for the output.

    Note

    If the font you specify is not available, a font with similar font characteristics is substituted.

  • STYLE cFontStyle
    Specifies a font style for output by the ? or ?? commands. If you omit the STYLE clause, the Normal font style is used. If the font style you specify is not available, a font style with similar characteristics is substituted.

    Note

    You must include the FONT clause when you specify a font style with the STYLE clause.

    The following table lists font styles that you can specify for cFontStyle.

    cFontStyle

    Font style

    B

    Bold

    I

    Italic

    N

    Normal

    Q

    Opaque

    -

    Strikeout

    T

    Transparent

    U

    Underline

    You can include more than one character to specify a combination of font styles. For example, the following command displays the system date in Courier Bold Italic:

    ? DATE( ) FONT 'COURIER' STYLE 'BI'
    

Remarks

To send the results to the printer only, use the following commands:

SET PRINTER ON 
SET CONSOLE OFF

To send the results to the printer and the main Visual FoxPro window or an active user-defined window, use the following command:

SET PRINTER ON

The setting of SET ALTERNATE affects the destination for the ? and ?? commands. For more information, see SET ALTERNATE Command.

The ? command displays binary data for Varbinary data types in hexadecimal format with no limitation on size. For more information, see Varbinary Data Type.

Example

The following example displays evaluates and displays the expressions specified:

? 15 * (10+10)
? 'Welcome to ' PICTURE '@!'
?? 'Visual FoxPro'

See Also

Reference

??? Command

@ ... SAY Command

_ALIGNMENT System Variable

SET MEMOWIDTH Command

SET PRINTER Command

SET SPACE Command

Format Property

InputMask Property

Other Resources

Commands (Visual FoxPro)