set the variable var to value if it does not have a value


  • This is a utility function for setting the default values of variables.
  • The following exceptions can be thrown by MSPSetDefault.
  • MSPException["ParseError"]if the value cannot be interpreted by Mathematica
    MSPException["SecurityError"]if the value does not pass the security test
    MSPException["ValueError"]if the value is not a string, this indicates a programmatic error by the page author
    MSPException["VariableError"]if the variable is not a Mathematica symbol, this indicates a programmatic error by the page author

ExamplesExamplesopen allclose all

Basic Examples (1)Basic Examples (1)

You can simulate how the function works by installing and loading the package.

Click for copyable input

Here $$var has a value, so its value is not modified.

Click for copyable input

If $$var has no value, MSPSetDefault will set it.

Click for copyable input
New to Mathematica? Find your learning path »
Have a question? Ask support »