Created
February 9, 2021 15:15
-
-
Save mikeyaunish/893e71ee6964eab977530a7269172341 to your computer and use it in GitHub Desktop.
Example of *** Throw Error: return or exit not in function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Red [ | |
Title: "find-in-array-BUG.red" | |
Needs: View | |
Comment: "Generated with Direct Code" | |
] | |
do setup:[ | |
find-in-array-at: function [ | |
blk [any-type!] | |
at-loc [integer!] | |
find-this | |
/with-index | |
/every | |
/local ndx i collected | |
][ | |
prin "" | |
;-- --------------------------------------------------------------------------- | |
;-- Adding the line above | |
;-- FIXES: *** Throw Error: return or exit not in function | |
;-- AT: find-in-array-at | |
;-- USING: Red 0.6.4 for Windows built 8-Jan-2021/16:47:49 | |
;-- WHEN: Changing any any objects' offset using the 'green arrows' in the Object Editor | |
;-- Once the 'prin' statement is commented out the error comes back | |
;-- --------------------------------------------------------------------------- | |
collected: copy [] | |
if ((length? blk) < 1) [ | |
return false | |
] | |
ndx: 1 | |
foreach i blk [ | |
if find-this = (pick i at-loc) [ | |
either with-index [ | |
either every [ | |
append/only collected reduce [ i ndx ] | |
][ | |
return reduce [ i ndx ] | |
] | |
][ | |
either every [ | |
append/only collected i | |
][ | |
return i | |
] | |
] | |
] | |
ndx: ndx + 1 | |
] | |
if every [ | |
either ((length? collected ) = 0 ) [ | |
return false | |
][ | |
return collected | |
] | |
] | |
return false | |
] | |
] | |
;Direct Code VID Code source marker - DO NOT MODIFY THIS LINE OR THE NEXT LINE! | |
view find-in-array-BUG-layout: [ | |
at 101x100 base1: base 80.154.0.0 190x91 white black "Hello" loose | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment