View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0004798 | FEM | Feature | public | 2021-12-06 11:56 | 2021-12-07 20:16 |
| Reporter | mac_the_bike | Assigned To | |||
| Priority | none | Severity | trivial | Reproducibility | N/A |
| Status | closed | Resolution | no change required | ||
| OS | ubuntu 18.04 | ||||
| Product Version | 0.20 | ||||
| Summary | 0004798: this is not a bug - but a query about the code | ||||
| Description | https://github.com/FreeCAD/FreeCAD/blob/master/src/Mod/Fem/femtools/ccxtools.py lines: 829->835 for m in self.analysis.Group: if m.isDerivedFrom("Fem::FemResultObject"): self.results_present = True break else: if self.solver.AnalysisType == "check": for m in self.analysis.Group: ... i can't see where the 'if' statement is for the 'else' i have written a small simpler program which has the same form as above: l = [1,2,3,4] for i in l: if(i==2): print("hello", i) else: print("world", i) and it works, in the sense that it executes the 'else' statement after it has completed the 'for' loop. mac | ||||
| Tags | FEM | ||||
| FreeCAD Information | OS: Ubuntu 18.04.6 LTS Word size of OS: 64-bit Word size of FreeCAD: 64-bit Version: 0.18.4. Build type: Release Python version: 2.7.15+ Qt version: 5.9.5 Coin version: 4.0.0a OCC version: 7.3.0 Locale: English/UnitedKingdom (en_GB) | ||||
|
|
The `else` is for the `for` statement. Please educate yourself about the `for... else..` expression in Python, e.g. https://book.pythontips.com/en/latest/for_-_else.html Additionally, the forum is a better place for such questions. Please begin a forum post for future doubts about the code, and only use the tracker if it is established to be a problem there. |
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2021-12-06 11:56 | mac_the_bike | New Issue | |
| 2021-12-06 11:56 | mac_the_bike | Tag Attached: FEM | |
| 2021-12-07 20:15 | jnxd | Note Added: 0016066 | |
| 2021-12-07 20:16 | jnxd | Status | new => closed |
| 2021-12-07 20:16 | jnxd | Resolution | open => no change required |
FreeCAD