Jim Tcl
Check-in [e328b9ce5b]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:docs: Remove docs for the case command

This command no longer exists in Jim Tcl, so remove it from the documentation.

Signed-off-by: Steve Bennett <steveb@workware.net.au>

Timelines: family | ancestors | descendants | both | trunk |
Files: files | file ages | folders
SHA1: e328b9ce5bffe46a0773fc7b3c719ef760209775
User & Date: steveb@workware.net.au 2019-11-06 07:04:20
Context
2019-11-06
07:39
docs: Formatting cleanups, consistency

Signed-off-by: Steve Bennett <steveb@workware.net.au> check-in: da3b52d11c user: steveb@workware.net.au tags: trunk,

07:04
docs: Remove docs for the case command

This command no longer exists in Jim Tcl, so remove it from the documentation.

Signed-off-by: Steve Bennett <steveb@workware.net.au> check-in: e328b9ce5b user: steveb@workware.net.au tags: trunk,

04:33
expr-sugar: $() should return non-error codes

If an expression returns (e.g.), break, continue or exit, that return code should be propagated, the same it is for [expr {}]

Signed-off-by: Steve Bennett <steveb@workware.net.au> check-in: 27524f281f user: steveb@workware.net.au tags: trunk,

Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to jim_tcl.txt.

1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802

1803
1804
1805
1806
1807
1808
1809

This command may be invoked only inside the body of a loop command
such as `for` or `foreach` or `while`.  It returns a +JIM_BREAK+ code
to signal the innermost containing loop command to return immediately.

case
~~~~
+*case* 'string' ?in? 'patList body ?patList body ...?'+

+*case* 'string' ?in? {'patList body ?patList body ...?'}+

*Note* that the `switch` command should generally be preferred unless compatibility
with Tcl 6.x is desired.

Match +'string'+ against each of the +'patList'+ arguments
in order.  If one matches, then evaluate the following +'body'+ argument
by passing it recursively to the Tcl interpreter, and return the result
of that evaluation.  Each +'patList'+ argument consists of a single
pattern or list of patterns.  Each pattern may contain any of the wild-cards
described under `string match`.

If a +'patList'+ argument is +default+, the corresponding body will be
evaluated if no +'patList'+ matches +'string'+.  If no +'patList'+ argument
matches +'string'+ and no default is given, then the `case` command returns
an empty string.

Two syntaxes are provided.

The first uses a separate argument for each of the patterns and commands;
this form is convenient if substitutions are desired on some of the
patterns or commands.

The second form places all of the patterns and commands together into
a single argument; the argument must have proper list structure, with
the elements of the list being the patterns and commands.

The second form makes it easy to construct multi-line case commands,
since the braces around the whole list make it unnecessary to include a
backslash at the end of each line.

Since the +'patList'+ arguments are in braces in the second form,
no command or variable substitutions are performed on them;  this makes
the behaviour of the second form different than the first form in some
cases.

Below are some examples of `case` commands:

    case abc in {a b} {format 1} default {format 2} a* {format 3}

will return '3',

    case a in {
        {a b} {format 1}
        default {format 2}
        a* {format 3}
    }

will return '1', and

    case xyz {
        {a b}
            {format 1}
        default
            {format 2}
        a*
            {format 3}
    }

will return '2'.


catch
~~~~~
+*catch* ?-?no?'code \...'? ?--? 'command ?resultVarName? ?optionsVarName?'+

The `catch` command may be used to prevent errors from aborting
command interpretation.  `catch` evaluates +'command'+, and returns a







|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
>







1734
1735
1736
1737
1738
1739
1740
1741





























































1742
1743
1744
1745
1746
1747
1748
1749

This command may be invoked only inside the body of a loop command
such as `for` or `foreach` or `while`.  It returns a +JIM_BREAK+ code
to signal the innermost containing loop command to return immediately.

case
~~~~
The obsolete '+*case*+' command has been removed from Jim Tcl since v0.75.





























































Use `switch` instead.

catch
~~~~~
+*catch* ?-?no?'code \...'? ?--? 'command ?resultVarName? ?optionsVarName?'+

The `catch` command may be used to prevent errors from aborting
command interpretation.  `catch` evaluates +'command'+, and returns a