Impressum
GoTo:
Home
 
die Amika Methode die Amika Methode   
 
Lesezeichen [ Jobs # QR-Code # Sitemapper ]Mi 11 Dez 2024 06:31:17


 huecker.com # Grundlagen der Programmierung | Tcl Tutorial.
--

 

. Information about procs - info .

[ Previous | Index | Next ]

The info command includes a set of subcommands that will provide all the info you could want about a proc. These subcommands will return the body of a proc, the arguments to the proc, and the value of any default arguments.

These subcommands can be used to:

  • Access the contents of a proc in a debugger.
  • Generate custom procs from a template.
  • Report default values while prompting for input.

Info commands that return information about a proc
info args procname
Returns a list of the names of the arguments to the procedure procname.
info body procname
Returns the body of the procedure procname.
info default procname arg varName
Returns 1 if the argument arg in procedure procName has a default, and sets varName to the default. Otherwise, returns 0.

--

. Example .

   proc demo {argument1 {default "DefaultValue"} } {
    puts "This is a demo proc. It is being called with $argument1 and $default"
   }

   puts "The args for demo are: [info args demo]\n"
   puts "The body for demo is:  [info body demo]\n"

   set arglist [info args demo]

   foreach arg $arglist {
    if {[info default demo $arg defaultval]} {
     puts "$arg has a default value of $defaultval"
    } else {
     puts "$arg has no default"
    }
   }
  

--
[ Home | Top ]
[ . Previous | Index | Next . ]
Der Inhalt dieser Seite wurde am 31.08.2024 um 13.36 Uhr aktualisiert.
Navigation Seminare Magic Software Projekte Publikationen Kontakt Home
 
   huecker dot com * Germany | Datenschutz
© 1999, 2024 Franz-Josef Hücker. All Rights Reserved.
Contact Print Page LinkedIn follow me on twitter RSS Feeds & Podcasts