Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > microsoft.public.excel.programming > #111193 > unrolled thread
| Started by | RG III <mob.rrr.3@gmail.com> |
|---|---|
| First post | 2019-10-15 00:42 -0700 |
| Last post | 2019-10-15 09:56 +0100 |
| Articles | 2 — 2 participants |
Back to article view | Back to microsoft.public.excel.programming
Early exit from function? RG III <mob.rrr.3@gmail.com> - 2019-10-15 00:42 -0700
Re: Early exit from function? Adrian Caspersz <email@here.invalid> - 2019-10-15 09:56 +0100
| From | RG III <mob.rrr.3@gmail.com> |
|---|---|
| Date | 2019-10-15 00:42 -0700 |
| Subject | Early exit from function? |
| Message-ID | <cb431177-cbf1-45c2-8c21-2e68b7bf61d7@googlegroups.com> |
Suppose I have the following function: '------------------------------------ Function foo(x as Integer) as Integer If (x < 1) Then foo = 1 ' Exit point? End If MsgBox "I hope I don't get this far." foo = 2 End foo '----------------------------------- Ideally, I'd like the function to exit as soon as I assign a value to the function name. So, if x = 0, then I'd like to immediately exit and have foo return 1. Is there a way to have functions exit as soon as they are assigned a value? Or do I need to hook up a bunch of "Goto" statements that jump to the last line? -Robert
[toc] | [next] | [standalone]
| From | Adrian Caspersz <email@here.invalid> |
|---|---|
| Date | 2019-10-15 09:56 +0100 |
| Message-ID | <h0lftlFgvaqU1@mid.individual.net> |
| In reply to | #111193 |
On 15/10/2019 08:42, RG III wrote: > Suppose I have the following function: > > '------------------------------------ > Function foo(x as Integer) as Integer > > If (x < 1) Then > foo = 1 ' Exit point? Exit Function https://docs.microsoft.com/en-us/dotnet/visual-basic/language-reference/statements/exit-statement -- Adrian C
[toc] | [prev] | [standalone]
Back to top | Article view | microsoft.public.excel.programming
csiph-web