Type detection: Difference between revisions

Added Wren
m (→‎{{header|Raku}}: update link name)
(Added Wren)
Line 1,262:
System.Double
System.Boolean
</pre>
 
=={{header|Wren}}==
{{libheader|Wren-fmt}}
<lang ecmascript>import "/fmt" for Fmt
 
var showType = Fn.new { |obj|
System.print("%(Fmt.s(10, obj)) has type %(Fmt.q(obj.type))")
}
 
var a = [4, 3.728, [1, 2], { 1: "first" }, true, null, 1..6, "Rosetta"]
a.each { |e| showType.call(e) }</lang>
 
{{out}}
<pre>
4 has type "Num"
3.728 has type "Num"
[1, 2] has type "List"
{1: first} has type "Map"
true has type "Bool"
Rosetta has type "String"
</pre>
 
9,488

edits