Why Loops End
CppCon, October 2023 Why Loops EndNo. 1The heat death of the universe👿 👿 😈 Will this loop ever end? 🙂 Yes! Execution increases the entropy of the universe, turning free energy into useless thermal specific? 😈 Will this loop end for some non-cosmological reason?🙂 That is very specific! But you’ll have to explain the part about the function interfaces. 😈 Will this loop end for some reason that: the bottom part of the interface.😈 Let’s call that sort of reason a local reason. Does the loop end for some local reason? 🙂 OK, now there's a local reason. 😈 Now can you write it in a way my robot0 码力 | 134 页 | 1.30 MB | 5 月前3Reference guide for Free Pascal, version 3.2.2
interesting result Function Beautiful : Integer; The comment extends from the // character till the end of the line. This kind of comment was introduced by Borland in the Delphi Pascal compiler. Free Pascal comment *) { This is a Turbo Pascal comment } // This is a Delphi comment. All is ignored till the end of the line. 13 CHAPTER 1. PASCAL TOKENS The following are valid ways of nesting comments: { Comment Turbo Pascal mode absolute and array asm begin case const constructor destructor div do downto else end file for function goto if implementation in inherited inline interface label mod nil not object of0 码力 | 268 页 | 700.37 KB | 1 年前3Hello 算法 1.2.0 简体中文 Ruby 版
def for_loop(n) res = 0 # 循环求和 1, 2, ..., n-1, n for i in 1..n res += i end 第 2 章 复杂度分析 www.hello‑algo.com 20 res end 图 2‑1 是该求和函数的流程框图。 图 2‑1 求和函数的流程框图 此求和函数的操作数量与输入数据大小 ? 成正比,或者说成“线性关系”。实际上,时间复杂度描述的就是 2, ..., n-1, n while i <= n res += i i += 1 # 更新条件变量 第 2 章 复杂度分析 www.hello‑algo.com 21 end res end while 循环比 for 循环的自由度更高。在 while 循环中,我们可以自由地设计条件变量的初始化和更新步 骤。 例如在以下代码中,条件变量 ? 每轮进行两次更新,这种情况就不太方便用 = 0 i = 1 # 初始化条件变量 # 循环求和 1, 4, 10, ... while i <= n res += i # 更新条件变量 i += 1 i *= 2 end res end 总的来说,for 循环的代码更加紧凑,while 循环更加灵活,两者都可以实现迭代结构。选择使用哪一个应该 根据特定问题的需求来决定。 3. 嵌套循环 我们可以在一个循环结构内嵌套另一个循环结构,下面以0 码力 | 372 页 | 18.44 MB | 10 月前3Modern C++ Iterators
a pointer over elements – From begin() til end() std::vectorv{10, 20, 30, 40, 50, 60, 70}; for (std::vector ::iterator pos = v.begin(); pos < v.end(); ++pos) { std::cout << *pos << '\n'; } std::string s{"device"}; for (std::string::iterator pos = s.begin(); pos < s.end(); ++pos) { std::cout << *pos << '\n'; } pos begin() end() 30 40 10 20 p: arr arr+2 arr+3 arr+4 arr+1 int arr[] = {10, 20 begin() end() c v i d e e ++ C++98/C++11 arr: ©2023 by josuttis.com 6 C++ Iterators: Generalization of Pointers that Iterate • Iterate like a pointer over elements – From begin() til end() std::vector 0 码力 | 24 页 | 1.93 MB | 5 月前3Drawing UML with PlantUML - PlantUML Language Reference Guide(Version 1.2023.11)
note right the autonumber works everywhere. Here, its value is ** %autonumber% ** end note Bob --> Alice: //This is the response %autonumber%// @enduml [Ref. QA-7119] 1.10 Page Title that will be displayed into the header (for group, see next paragraph ’Secondary group label’). The end keyword is used to close the group. Note that it is possible to nest groups. @startuml Alice -> Bob: attack start loop 1000 times Alice -> Bob: DNS Attack end Alice -> Log : Log attack end end else Another type of failure Bob -> Alice: Please repeat end @enduml 1.13 Secondary group label For group, it0 码力 | 551 页 | 7.79 MB | 1 年前3PlantUML 1.2023.11 Справочное руководство по языку
autonumber . ** %autonumber% ** end note Bob --> Alice: //This is the response %autonumber%// @enduml [Ref. QA-7119] 1.10 Название, Заголовок заголовке. (для group, смотрите следующий параграф ’Дополнительная метка группы’). Ключевое слово end используется для завершения группы. Допустимо вложение группы в группу. @startuml Alice -> Bob: Authentication attack start loop 1000 times Alice -> Bob: DNS Attack end Alice -> Log : Log attack end end else Another type of failure Bob -> Alice: Please repeat end @enduml 1.13 Дополнительная метка группы Для group0 码力 | 554 页 | 7.96 MB | 1 年前3Hello 算法 1.2.0 繁体中文 Ruby 版
def for_loop(n) res = 0 # 迴圈求和 1, 2, ..., n-1, n for i in 1..n res += i end 第 2 章 複雜度分析 www.hello‑algo.com 20 res end 圖 2‑1 是該求和函式的流程框圖。 圖 2‑1 求和函式的流程框圖 此求和函式的操作數量與輸入資料大小 ? 成正比,或者說成“線性關係”。實際上,時間複雜度描述的就是 2, ..., n-1, n while i <= n res += i i += 1 # 更新條件變數 第 2 章 複雜度分析 www.hello‑algo.com 21 end res end while 迴圈比 for 迴圈的自由度更高。在 while 迴圈中,我們可以自由地設計條件變數的初始化和更新步 驟。 例如在以下程式碼中,條件變數 ? 每輪進行兩次更新,這種情況就不太方便用 = 0 i = 1 # 初始化條件變數 # 迴圈求和 1, 4, 10, ... while i <= n res += i # 更新條件變數 i += 1 i *= 2 end res end 總的來說,for 迴圈的程式碼更加緊湊,while 迴圈更加靈活,兩者都可以實現迭代結構。選擇使用哪一個應 該根據特定問題的需求來決定。 3. 巢狀迴圈 我們可以在一個迴圈結構內巢狀另一個迴圈結構,下面以0 码力 | 372 页 | 18.75 MB | 10 月前3PlantUML 을사용해서 UML 그리기 - PlantUML 언어참조가이드(Version 1.2023.11)
note right the autonumber works everywhere. Here, its value is ** %autonumber% ** end note Bob --> Alice: //This is the response %autonumber%// @enduml [Ref. QA-7119] 1.10 페이지제목, 머리말과꼬리말 2023.11) 11 / 551 1.13 보조그룹레이블 1 시퀀스다이어그램 헤더에표시될텍스트를추가할수있다. (group 에대해서는, 다음 ’ 보조그룹레이블’ 을참조하십시오.). end 키워드는그룹을닫는데사용한다. 또한, 그룹을중첩해서만들수도있다. @startuml Alice -> Bob: Authentication Request alt successful attack start loop 1000 times Alice -> Bob: DNS Attack end Alice -> Log : Log attack end end else Another type of failure Bob -> Alice: Please repeat end @enduml 1.13 보조그룹레이블 group 을위해, [ 하고 ] 사이에, 머릿글0 码力 | 552 页 | 7.88 MB | 1 年前3PlantUML 1.2020.23 Справочное руководство по языку
должен быть отображен в заголовке. Ключевое слово end используется для завершения группы. Имейте ввиду что допускаются вложенные группы. Ключевое слово end закрывает группу. Допустимо вложение группы в attack start loop 1000 times Alice -> Bob: DNS Attack end Alice -> Log : Log attack end end else Another type of failure Bob -> Alice: Please repeat end @enduml 1.12 Secondary group label For group, it label 2] Alice -> Log : Log attack start loop 1000 times Alice -> Bob: DNS Attack end Alice -> Log : Log attack end end @enduml [Ref. QA-2503] 1.13 Примечания в сообщениях Можно помещать заметки к сообщениям0 码力 | 306 页 | 3.12 MB | 1 年前3PlantUML 1.2023.11 Sprachreferenz
PlantUML Sprachreferenz (1.2023.11) 9 / 528 1.13 Zweites Label für group 1 SEQUENZDIAGRAMM Das end Schlüsselwort wird verwendet, um die Gruppe zu schließen. Weiterhin ist es möglich, mehrere Gruppen attack start loop 1000 times Alice -> Bob: DNS Attack end Alice -> Log : Log attack end end else Another type of failure Bob -> Alice: Please repeat end @enduml 1.13 Zweites Label für group Nach dem Schlüsselwort label 2] Alice -> Log : Log attack start loop 1000 times Alice -> Bob: DNS Attack end Alice -> Log : Log attack end end @enduml [Ref. QA-2503] 1.14 Notizen Notizen zu einer Nachricht werden mit dem Schlüsselwort0 码力 | 529 页 | 7.46 MB | 1 年前3
共 1000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 100