Type detection: Difference between revisions
Content added Content deleted
Line 1,248: | Line 1,248: | ||
typeOf value: [ 1 print ]. |
typeOf value: [ 1 print ]. |
||
typeOf value: thisContext. "that is the current stack frame" |
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 / 0 ] on:Error do:[:ex | typeOf value: ex ]. "catch the exception" |
||
[ 1 fooBar ] on: |
[ 1 fooBar ] on:Error do:[:ex | typeOf value: ex ].</lang> |
||
{{out}} |
{{out}} |
||
<pre>arg is of type SmallInteger and prints itself as: "1234" |
<pre>arg is of type SmallInteger and prints itself as: "1234" |
||
Line 1,262: | Line 1,264: | ||
arg is of type TopView and prints itself as: "a TopView" |
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 OSXOperatingSystem class and prints itself as: "OSXOperatingSystem" |
||
arg is of type Timestamp and prints itself as: "2020-12-25 23: |
arg is of type Timestamp and prints itself as: "2020-12-25 23:48:59.287" |
||
arg is of type ImmutableArray class and prints itself as: "ImmutableArray" |
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 Metaclass and prints itself as: "ImmutableArray class" |
||
Line 1,268: | Line 1,270: | ||
arg is of type Block and prints itself as: "[] in UnboundMethod>>doIt" |
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 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 ZeroDivide and prints itself as: "division by zero" |
||
arg is of type MessageNotUnderstood and prints itself as: "SmallInteger does not understand: "fooBar"" |
arg is of type MessageNotUnderstood and prints itself as: "SmallInteger does not understand: "fooBar"" |
||
</pre> |
|||
=={{header|VBA}}== |
=={{header|VBA}}== |