Macaulay2 » Documentation
Packages » Macaulay2Doc » The Macaulay2 language » Thing » Pseudocode » value(Pseudocode)
next | previous | forward | backward | up | index | toc

# value(Pseudocode) -- execute pseudocode

- Function: value
- Usage:
    `value p`
- Inputs:
  - p, an instance of the type Pseudocode
- Outputs:
  - the value returned by evaluation of p

## Description

Here is an example of its use in the debugger, to see whether modifying the value of a local variable fixed the problem in the code, by executing just the offending line.

    i1 : load "Macaulay2Doc/demos/demo1.m2"

    i2 : g 2
    /usr/share/Macaulay2/Macaulay2Doc/demos/demo1.m2:8:11:(3):[2]: error: division by zero
    /usr/share/Macaulay2/Macaulay2Doc/demos/demo1.m2:8:11:(3): entering debugger (enter 'help' to see commands)
    /usr/share/Macaulay2/
    Macaulay2Doc/demos/demo1.m2:8:10-8:13: --source code:
         b := 1/x;

    ii3 : value current
    /usr/share/Macaulay2/Macaulay2Doc/demos/demo1.m2:8:11:(3): error: division by zero

    ii4 : x = 11

    oo4 = 11

    ii5 : value current

           1
    oo5 = --
          11

    oo5 : QQ

## See also

- current -- the pseudocode that produced an error
- pseudocode -- produce the pseudocode for a function

## Ways to use this method:

- value(Pseudocode) -- execute pseudocode

The source of this document is in /build/macaulay2-88fgJW/macaulay2-1.25.11+ds/M2/Macaulay2/packages/Macaulay2Doc/ov_repl.m2:1089:0.