>>
<<
Ndx
Usr
Pri
Phr
Dic
Rel
Voc
!:
wd
Help
Dictionary
throw.
throw. cuts the stack back to the catcht. section
of a try. and resumes execution there;
a throw. executed outside of a try.
with a catcht. causes a return to immediate execution.
|
For example:
main=: 3 : 0
try.
sub y.
catcht.
select. type_jthrow_
case. 'aaaa' do. 'throw aaaa'
case. 'bbb' do. 'throw bbb'
case. 'cc' do. 'throw cc'
case. do. throw. NB. handled by higher-level catcht. (if any)
end.
end.
)
sub=: 3 : 0
if. y.<0 do. type_jthrow_=: 'aaaa' throw. end.
if. y.<4 do. type_jthrow_=: 'bbb' throw. end.
if. y.<8 do. type_jthrow_=: 'cc' throw. end.
(":y.),' not thrown'
)
main _4
throw aaaa
main 1
throw bbb
main 5
throw cc
main 88
88 not thrown
A throw. can communicate information back to
a catcht. through the use of a global name in a locale,
as illustrated in the examples above.
>>
<<
Ndx
Usr
Pri
Phr
Dic
Rel
Voc
!:
wd
Help
Dictionary