cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

How to use "on error" in my function.

mzarrabi
13-Aquamarine

How to use "on error" in my function.

Hi everybody. I have attached a picture of my function. Does anyone know how to find a way that the while loop goes to the next loop whenever there is an error in the D_M function?  My current way of coding does not work and I cannot find the reason.

ACCEPTED SOLUTION

Accepted Solutions
MJG
18-Opal
18-Opal
(To:mzarrabi)

I believe the following two options would give you what you want:

Capture.PNG

View solution in original post

6 REPLIES 6
RichardJ
19-Tanzanite
(To:mzarrabi)

The format for "on error" is "x  on error y". It evaluates y, and if that gives an error, it returns x instead. That is not what you have. Note that you cannot just type "on error" into a placeholder. You must enter it from the programming toolbar.

mzarrabi
13-Aquamarine
(To:RichardJ)

Dear Richard,

Thank you for your response. Now, I understand what was the problem. I modified it a little bit. Now there is another problem.  When yj equals to "x.calculations" the function stops as I want, but it does not show "x.calculation" as the last answer.

Best,

Werner_E
25-Diamond I
(To:mzarrabi)

use

 

return "x.calculation"

 

instead of

 

"x.calculation"

break

 

Note, that "return" is a command liek "if" or "on error" and you have to chose it from the toolbar and can't simply type it in.

 

mzarrabi
13-Aquamarine
(To:Werner_E)

you are right, but if I use "return", the function gives me the last value of y. In fact, I'd like to see previous values of y also.

MJG
18-Opal
18-Opal
(To:mzarrabi)

I believe the following two options would give you what you want:

Capture.PNG

mzarrabi
13-Aquamarine
(To:MJG)

Thank you very much MjG. It works well now.

Announcements

Top Tags