Defining a Function with a Program

The following steps illustrate how to define a simple program which takes two arguments, divides the first argument by the second, and returns the base-10 logarithm of the result.

  1. Type the left side of a function definition, followed by [:] for the definition symbol.

    f(x,w) := placeholder

  2. Define a local variable by typing the variable name (in this case, z), followed by the local assignment operator. This defines z only within the scope of this program; outside the program, z is undefined and has no effect.

    z will be defined only within the program

  3. Complete the local assignment, in this case by typing x/w in the placeholder to the right of the arrow. Select the entire expression.

    z is defined as x/w

  4. Use the Add Line operator to add a second placeholder below the definition for an additional program statement (a program can have any number of statements).

    a second line is added to the program

  5. The last placeholder should always contain the value returned by the program. Type log(z) into this placeholder.

    the program returns the base-10 log of z

Notes:

QuickSheet

Related Topics