Version 4 of What's My Line?

Updated 2013-09-29 15:01:35 by RLE

What's My Line? is a game-style exercise where the goal is to guess the output of the Tcl script

Description

The following Tcl scripts are arranged in ascending order roughly according to the level of challenge the pose. The task is simple: read a script, and then guess what the output will be. Actually writing down your answer before looking at the answer is highly recommended. When you get something wrong, spend some time writing similar scripts in order to explore the subject in more detail.

Size your browser window so that the answer is not visible while you form your own answer.

Scripts

What's My Line: No Soup For You

proc proc {args} {
    puts {No soup for you!}
}

proc hello {} {
    puts {Hi there!}
}

catch {hello} res
puts $res

















































































Answer:

No soup for you!
invalid command name "hello"

The built-in [proc] is placed by a user-defined procedure that, instead of creating new procedures, prints No soup for you!. proc hello... then doesn't create a hello procedure, so when an attempt is made to invoke hello, no such command is found, and an error is produced instead.