# Questions tagged [return-value]

The tag has no usage guidance.

27 questions
Filter by
Sorted by
Tagged with
68 views

### How to get the value of expression if I have some equalities?

I have this system of equations: ...
53 views

### How to modify the argument of a specific function below?

I would like to change the values of a and b in the following function: ...
• 254
224 views

### about Return value of Module[]

questions are in the below code. Although I'm pretty sure of the answer, I still feel a little uncomfortable, because I feel that the format of the body of Module[] ...
• 353
406 views

### How to get a function from a string?

I'm trying to create a function that takes in input a function written as string and the return it applying a ToExpression and an Evaluate (Code below). The goal of this function is to transform the ...
• 69
55 views

### How to use Mathematica to return value from for-loop [duplicate]

I tried to use Mathematica to implement random generator. The pseudo code I use is as following: ...
• 47
70 views

According to these answers, when several heterogeneous results (say {MTensor, mint, double}) are needed to be returned from a LibraryLink ...
• 163
823 views

### How to return two values from function

I have a function that generates cipher text for ElGamal encryption and I want to make return two values, but it returns only one. This is the code: ...
54 views

### How to get While to Return a Custom Value?

The Documentation for While says: Unless an explicit Return is used, the value returned by While is Null. But how do I implement it? I'd like to build a function ...
65 views

### Return[] being saved to DownValues

Example: f[x_] := f[x] = (If[x < 0, Return[x]]; x) f[1]; f[-5]; DownValues[f][[1 ;; 2]] (* {HoldPattern[f[-5]] :> Return[-5], HoldPattern[f[1]] :> 1} *) ...
• 1,093
126 views

### Vanishing function and Manipulate

Within Manipulate, I want to vanish certain controls if other controls satisfy a specific condition. The simplest case is to consider two checkboxes, ...
• 4,863
957 views

### Best practice with Return in Module or Block

I am a bit confused on the use of Return in either Block or Module when defining a custom ...
• 289
365 views

### Defining a function that has no return value

How can I define a function with no return value. For example, the Notation function from the Notation package seems to have no return value; I am looking to do the same thing for some of my custom ...
• 2,277
142 views

### Compound Statements and returning earlier results in () parentheses

I am trying to debug some script and need to Print[] out some results, sometimes before, and sometimes after, certain executions. These 3 trials exemplify my ...
• 445
106 views

### Catch parameter order and error using functional form

Question: Why does this fail? In:= (Catch[#] &)[Throw[17]] ...
• 1,525
1 vote
166 views

### Iterations in Mathematica [closed]

this is probably a very easy question for all of you. I have a stochastic Mathematica code (not important what it's exactly) which gives me a number at the end. Now I want Mathematica to run this ...
1 vote
129 views

### Returning value if a point is in a region?

I'm writing a function so that if the user clicks on a certain region, a value is returned. The function takes in a condition list like the one below and a point. ...
455 views

### How to force Return[] to return from an arbitrary point (like in C++)?

I need to test some complicated conditions to calculate a Return value. But MMa doesn't let you Return[] from anywhere the way C++ does. The structure of my Module is similar to this: ...
• 4,612
196 views

### Throw and Catch return wrong result inside Compile

Consider this code: fun = Compile[{{i, _Integer}}, Catch[Do[ If[j >= i, Throw[j]] , {j, 1, 10}]] ] I put an integer as argument then if this ...
• 3,874
1 vote
235 views

### Throw and Catch or Return inside Compile

Consider this code: ...
• 3,874
1 vote
1k views

### How to check empty tables using SQL Select or Execute?

If[SQLExecute[con, "Select * from TABLE"] == "{}", Print["TRUE"], Print["FALSE"]] I need to know the way, if the TABLE is empty or not
230 views

### Returning ancillary computation results from a function

Suppose I want to implement a function to solve a very basic Elliptic problem using Finite Element of some degree (It's just an example). Normally the user of my function is only interested to the ...
• 7,103
7k views

### Returning a value from a Module

In the following simple example MyMod := Module[{i}, Do[ Return[1], {i, 3} ]; Print["test"] ] I expected the module to exit on ...
• 1,094
222 views

### Return struct from function (with DownValues)

In Mathematica there is a way to create struct-like data type: struct[myField]=value I want to return myStruct from a function: ...
• 311
5k views

### Function returning Null along with other unexpected expressions

When I use some function, at the end along with the output I get some NULLs returned that I don't understand the reason for and are highly undesirable. For example, when I define the reversal of list ...
• 2,073
2k views

### How can I return a Sequence?

Recently I had the need to redefine a certain symbol in my init.m so it would be automatically omitted from any lists it appears in. I decided to redefine it to an empty sequence, e.g. ...
• 283
3k views

### Compile and "True should be a machine-size real number..." Error

I am trying to compile a little summation function. As far as I understand, because the built-in Sum function can also return NaN...
• 549