View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0036090 | FPC | Documentation | public | 2019-09-19 22:04 | 2019-09-19 23:34 |
Reporter | Kirinn | Assigned To | Michael Van Canneyt | ||
Priority | normal | Severity | minor | Reproducibility | N/A |
Status | resolved | Resolution | fixed | ||
Product Version | 3.0.4 | Product Build | |||
Target Version | Fixed in Version | 3.3.1 | |||
Summary | 0036090: Clarify documentation on case-else statement | ||||
Description | Reference guide, the case statement (13.2.2) The case else part works implicitly as a block, accepting multiple command statements, which is by design. The documentation should be clearer on this. It says: "The case statements can be compound statements (i.e. a Begin..End block)." To this could be added: "The else part can contain multiple statements even without a Begin..End block." Additionally, under the section "The following are valid case statements", one of the examples should include a two-line else statement to show it is possible. | ||||
Tags | No tags attached. | ||||
Fixed in Revision | 1654 | ||||
FPCOldBugId | |||||
FPCTarget | 3.2.0 | ||||
Attached Files |
|
|
The else part CAN'T contain multiple statements without begin..end. A counterexample would be necessary. Note that if you need multiple else statements, you are probably of the track. Search for dangling else. |
|
@marco, of course the else part can contain multiple statements: begin case random(10) of 1 : writeln(1); else Writeln('a'); Writeln('b'); Writeln('ahah'); end; end. compiles and runs fine. You can't have multiple else clauses of course. |
|
Well, the syntax diagram clearly mentions 'statement list' in the else clause. But I added an example, and made it more explicit. |
Date Modified | Username | Field | Change |
---|---|---|---|
2019-09-19 22:04 | Kirinn | New Issue | |
2019-09-19 22:04 | Kirinn | Status | new => assigned |
2019-09-19 22:04 | Kirinn | Assigned To | => Michael Van Canneyt |
2019-09-19 22:49 | Marco van de Voort | Status | assigned => feedback |
2019-09-19 22:49 | Marco van de Voort | FPCTarget | => - |
2019-09-19 22:49 | Marco van de Voort | Note Added: 0118123 | |
2019-09-19 23:23 | Michael Van Canneyt | Note Added: 0118125 | |
2019-09-19 23:34 | Michael Van Canneyt | Status | feedback => resolved |
2019-09-19 23:34 | Michael Van Canneyt | Resolution | open => fixed |
2019-09-19 23:34 | Michael Van Canneyt | Fixed in Version | => 3.3.1 |
2019-09-19 23:34 | Michael Van Canneyt | Fixed in Revision | => 1654 |
2019-09-19 23:34 | Michael Van Canneyt | FPCTarget | - => 3.2.0 |
2019-09-19 23:34 | Michael Van Canneyt | Note Added: 0118126 |