Menu

#92 global vars cant be used in current impl of sum/prod()

M1_1.0
open
biiej
None
5
2009-01-29
2009-01-28
Anonymous
No

global vars cant be used in current impl of sum/prod()

Discussion

  • Nobody/Anonymous

    this is due sum in enclosed into function definition

     
  • Nobody/Anonymous

    there might be no viable solution to the dilemma
    either one can use sum in more complex expressions
    and sums within sums or global vars are inaccessible
    workaround is to either put sum into function
    definition to do not use global variables

     
  • Nobody/Anonymous

    In order to change the value of the global variable x,
    you must also declare it to be global within
    the function body, like this:

    function f ()
    global x;
    x = 1;
    endfunction

    Other words accessed variables must be identified and
    marked as global ...

     
  • Nobody/Anonymous

    solution would be to define global(x)
    that would formally define global vars ...

     
  • biiej

    biiej - 2009-01-29
    • milestone: --> M1_1.0
     
  • biiej

    biiej - 2009-01-29
    • assigned_to: nobody --> biiej
     

Log in to post a comment.

MongoDB Logo MongoDB