Need info about return -<options> in TCL -


what options available in tcl return command ? see -code -errorcode -errorinfo options return command.. couldn't understand difference between them.

proc new {} { set name george puts "hello $name" return -code ok } puts [new] 

here didn't output, normal return command. more option -code in return command break , continue, error , retun... use of options. , below code makes me confuse ..

proc new {} { set name george puts "hello $name" return -code return -code return -code return } 

like can give more , didn't errored , use of option..

the options return listed on man page: return.

-errorcode, -errorinfo, -errorstack, , -level used describe aspects of exception: -options allows 1 pass dictionary of exception data command. neither of these useful until have thorough understanding of language , writing advanced exception handling code.

the -code option used specify kind of handling surrounding code need perform. ok means no special handling necessary , result of command valid data; error means catch or try handler needs in place or program end, , result of command error message. break , continue need enclosing looping command (or catch / try command appropriate handler clause). return makes command used behave return command. won't need deal option unless writing own control structures.

the -level option lets return command return somewhere else in caller (but still in call stack). if value 0, return action "in place": return return without terminating script part of. first line of

set foo [return -level 0 bar] puts {i'm still alive} 

will executed set foo bar, , evaluation continue puts command. -level 1 means return caller (the usual behavior), -level 2 means return caller's caller, , on.

the return command accepts in argument list, , many commands won't complain arguments being repeated. return -code return -code return -code return same thing return -code return.


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -