The switch command matches its string argument against each of the pattern arguments in order.

Example:

set thickness t2
switch $thickness {
    t1 { puts 0.01 }
    t2 { puts 0.02 }
    t3 { puts 0.03 }
    t4 { puts 0.04 }
    default { puts "unknown" }
}

Result:

0.02

Discover more from Tips and Hints for Aerospace Engineers

Subscribe now to keep reading and get access to the full archive.

Continue reading