[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.3.1.4 Assign Variable from Console ($G)

This command lets you assign a variable from console. It is typically used to let the user enter experiment parameters at run time, such as entering a variable (using the keyboard) at the start of a testlist.

An integer value is read from the keyboard; the specified variable is set to the value read. This command will skip leading whitespace, and will set the variable to zero if the input could not be converted to a valid number.

The user can backspace over typed characters, however instead of characters disappearing, the deleted character will appear inside of two slashes '/x/'. This is because the character-grabbing routine has no idea where the character was displayed on the screen.

Name:
Assign Variable from Console
Class:
Control
Code:
$G
Syntax:
$Gv1
v1 is a variable reference
System:
Cogsys reads a string from the keyboard, converts it to an integer, and stores the result in the Cogsys variable v1.
Requires:
Although this command will work in any mode, for the user to see the characters being typed, Cogsys must be in a text mode.

Test Files:
AVKB_T01.IN: Tests basic operation

 
@CPress any key to assign an integer value to
the Cogsys variable V12 (\$GV12)#R

Enter an integer number: $GV12
@1010 Variable V12 now has value $SV12
@1210 Press any key to exit.#R#S/V12 is ^V12/

Examples:

input
$GV12
subject
enters 234 at keyboard
cogsys
assigns 234 to the value of V12



This document was generated on November, 24 2008 using texi2html