Introspection: Difference between revisions

Add Jsish
No edit summary
(Add Jsish)
Line 913:
 
<code>abs</code> is a method of the Math object, methods are properties, and the <code>in</code> operator tests whether an object has the named property.
 
=={{header|Jsish}}==
<lang javascript>/* Introspection, in jsish */
if (Info.version() < 2.0806) {
puts("need at least version 2.0806 of jsish");
exit(1);
}
 
if ((bloop != undefined) && (typeof Math.abs == 'function')) {
puts(Math.abs(bloop));
}
 
var nums = 0, sums = 0, v;
for (v of Info.vars(this)) {
if (isFinite(this[v])) {
nums++;
sums += this[v];
}
}
printf("%d numerics with sum of: %d\n", nums, sums);</lang>
 
{{out}}
<pre>prompt$ jsish introspection.jsi
2 numerics with sum of: 2</pre>
 
=={{header|Julia}}==
Anonymous user