Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,14 @@
|
|||
|didDivideByZero a b|
|
||||
|
||||
didDivideByZero := false.
|
||||
a := 10.
|
||||
b := 0.
|
||||
[
|
||||
a/b
|
||||
] on: ZeroDivide do:[:ex |
|
||||
'you tried to divide %P by zero\n' printf:{ex suspendedContext receiver} on:Transcript.
|
||||
didDivideByZero := true.
|
||||
].
|
||||
didDivideByZero ifTrue:[
|
||||
Transcript show:'bad bad bad, but I already told you in the handler'.
|
||||
].
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
testZeroDivide :=
|
||||
[:aBlock |
|
||||
[
|
||||
aBlock value.
|
||||
false
|
||||
] on: ZeroDivide do: [true].
|
||||
].
|
||||
|
||||
"Testing"
|
||||
testZeroDivide value: [2/1] "------> false"
|
||||
testZeroDivide value: [2/0] "------> true"
|
||||
|
|
@ -0,0 +1 @@
|
|||
[...] on:Error do: [...]
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
|a b result|
|
||||
a := 10. b := 0.
|
||||
result := [a / b] on:ZeroDivide do:[:ex | ex proceedWith:Float infinity].
|
||||
Transcript showCR:result.
|
||||
Loading…
Add table
Add a link
Reference in a new issue