Introspection: Difference between revisions

From Rosetta Code
Content added Content deleted
(New page: This task asks to <ul> <li> verify the version/revision/patchlevel of you currently running (compiler/interpreter/byte-compiler/runtime environment/whatever your language uses) and exit if...)
 
No edit summary
Line 1: Line 1:
{{task}}

This task asks to <ul>
This task asks to <ul>
<li> verify the version/revision/patchlevel of you currently running (compiler/interpreter/byte-compiler/runtime environment/whatever your language uses) and exit if it is too old.
<li> verify the version/revision of your currently running (compiler/interpreter/byte-compiler/runtime environment/whatever your language uses) and exit if it is too old.
<li> check whether the variable "bloop" exists and whether the math-function "abs()" is available and if yes compute <i>abs(bloop)</i>.
<li> check whether the variable "bloop" exists and whether the math-function "abs()" is available and if yes compute <i>abs(bloop)</i>.
</ul>
</ul>



==[[Tcl]]==
[[Category:Tcl]]

package require Tcl 8.2 ; # throws an error if older
if {[info exists bloop] && [llength [info functions abs]]} {
puts [expr abs($bloop)]
}

Revision as of 00:16, 15 March 2007

Task
Introspection
You are encouraged to solve this task according to the task description, using any language you may know.

This task asks to

  • verify the version/revision of your currently running (compiler/interpreter/byte-compiler/runtime environment/whatever your language uses) and exit if it is too old.
  • check whether the variable "bloop" exists and whether the math-function "abs()" is available and if yes compute abs(bloop).


Tcl

package require Tcl 8.2 ; # throws an error if older
if {[info exists bloop] && [llength [info functions abs]]} {
  puts [expr abs($bloop)]
}