Type detection: Difference between revisions

Line 1,248:
typeOf value: [ 1 print ].
typeOf value: thisContext. "that is the current stack frame"
typeOf value: #+.
typeOf value: (SmallInteger >> #+).
[ 1 / 0 ] on:Error do:[:ex | typeOf value: ex ]. "catch the exception"
[ 1 fooBar ] on:ExceptionError do:[:ex | typeOf value: ex ].</lang>
{{out}}
<pre>arg is of type SmallInteger and prints itself as: "1234"
Line 1,262 ⟶ 1,264:
arg is of type TopView and prints itself as: "a TopView"
arg is of type OSXOperatingSystem class and prints itself as: "OSXOperatingSystem"
arg is of type Timestamp and prints itself as: "2020-12-25 23:4348:5059.907287"
arg is of type ImmutableArray class and prints itself as: "ImmutableArray"
arg is of type Metaclass and prints itself as: "ImmutableArray class"
Line 1,268 ⟶ 1,270:
arg is of type Block and prints itself as: "[] in UnboundMethod>>doIt"
arg is of type Context and prints itself as: "UndefinedObject(**DIRECTED**) >> doIt [20]"
arg is of type Symbol and prints itself as: "+"
arg is of type SmallInteger and prints itself as: "1234"
arg is of type Float and prints itself as: "1234.456"
arg is of type Fraction and prints itself as: "(1/2)"
arg is of type Complex and prints itself as: "(3+4i)"
arg is of type LargeInteger and prints itself as: "15511210043330985984000000"
arg is of type True and prints itself as: "true"
arg is of type UndefinedObject and prints itself as: "nil"
arg is of type String and prints itself as: "hello world"
arg is of type Interval and prints itself as: "1 to:100"
arg is of type TopView and prints itself as: "a TopView"
arg is of type OSXOperatingSystem class and prints itself as: "OSXOperatingSystem"
arg is of type Timestamp and prints itself as: "2020-12-25 23:49:24.059"
arg is of type ImmutableArray class and prints itself as: "ImmutableArray"
arg is of type Metaclass and prints itself as: "ImmutableArray class"
arg is of type ImmutableArray and prints itself as: "#()"
arg is of type Block and prints itself as: "[] in UnboundMethod>>doIt"
arg is of type Context and prints itself as: "UndefinedObject(**DIRECTED**) >> doIt [20]"
arg is of type Symbol and prints itself as: "+"
arg is of type Method and prints itself as: "a Method(SmallInteger >> +)"
arg is of type ZeroDivide and prints itself as: "division by zero"
arg is of type MessageNotUnderstood and prints itself as: "SmallInteger does not understand: "fooBar""</pre>
</pre>
 
=={{header|VBA}}==
Anonymous user