Alice 3 Chapter 12
return statement
A function must have at least one _______. When this is executed, control returns to the code statement that called the function. When control returns, the value specified by this is used in place of the function call.
Helper Procedure
A procedure that helps another procedure carry out its task.
Traditional user Input
Alice displays a prompt box on the screen and waits for the player (user) to enter a value as part of a call to an input function.
While control structure
Considered a conditional structure because it checks the value of a conditional expression.
Changing the value of an integer
To allow a user to change the value of an integer variable you can create a whole number variable and then create an assignment statement in the code by doing the following: 1. Drag the assign tile into the editor 2. Select the variable name from the popup menu 3. Select a =0 from the cascading menu as a placeholder 4. Replace the placeholder by selecting this in the Scene editior's Object Selector, then dragging the getIntegerFromUser tile from the Functions tab into the editor and dropping it on top of the placeholder. 5. Select Custom TextString from the drop down menu 6. Type in the text string you want to use to prompt the user. 7. Click OK.
value
When an input function is called, the _____ entered by the user will be returned to the calling statement. The returned value must immediately be used or it may be stored in a variable for use in a later statement.
A while statement
evaluates a conditional expression and if the value is true, the instructions within the code block are performed. This is similar to an if/else statement where a condition is checked before instructions may or may not be performed. However, an if/else statement executes just once and then the flow of execution continues on to the statement following the if/else code block.
Four built-in input functions
provided to prompt for a Boolean (true/false), String (text string), Double (decimal number), or Integer (whole number) value.
While loop
repetition occurs again and again until the condition becomes false. When the it's condition evaluates to false, execution flow exits the loop and skips to the next statement following the while code block.
To view the list of input functions
select this in the Scene Editor's Object Selector. Then in the Function tab, scroll down to the prompt user section.
Infinite loop
If the condition never becomes false, the cycle is unending and while is said to be
Custom function
To declare this for a Scene do the following: 1. Click the Add Scene Function button 2. In the popup dialog box, select the desired data type for the return type (the data type of the value to be returned by the function) 3. Enter a name for the function 4. Click Okay
