Alice Community  

Go Back   Alice Community > Alice 2 > How do I...?

Thread Tools Display Modes
Posts: n/a
Default Variables - 11-27-2006, 12:02 PM

I have done a little programming in TI-Basic for the calculator, and would like to know if it is possible to manipulate variables in a way that you can use an equation with variables, then set the resulting number as another variable for future use.

An example...

(Ask user for input1), a (User gives 10)
(Ask user for input2), b (User gives 5)
(Ask user for input3), c (User gives 2)

a x b / c = 25
Store 25 as d
d x a / b = 50
Store 50 as e
e / d = ? (Find this value)
Is this possible?

Thanks for any input. (pun intended)

Last edited by PogoDaMonkey; 11-27-2006 at 12:04 PM.
Reply With Quote
Parameters and Variables
Posts: n/a
Default Parameters and Variables - 11-27-2006, 08:03 PM

Alice supports both "parameters" and "variables". Variables are local to a method and are reset to their default value each time the method is started - so unless you keep the method running, the value won't be permanent. (Since the world is always running, world level variables will keep their values regardless of what other methods are active.)

Parameters are values passed to functions and other methods. In both the function and method templates there are buttons to click on to create new parameters or variables which will bring up menus to select name, data type, etc. You can also create a world level variable by clicking on a button in the world property list.

Once you have created a variable or parameter, you can drag in into the main edit area and set its value. There are too many option to describe here but basically there are math functions that can be used in the pull down menus and a variety of object level and world level functions which can be seen in the respective function lists.

If you have access to one of the texts, you might go through the index references to "functions" and "variables" - although they really cover only a few of the many options available. The best way is just to spend some time working with the options - especially the world level functions - see .
Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Copyright ©2023, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.