{"action":"created","comment":{"url":"https://api.github.com/repos/SW413/Paper/pulls/comments/26381986","id":26381986,"diff_hunk":"@@ -0,0 +1,87 @@\n+\\section{Control Flow}\\label{subsec:control-flow}\r\n+Control flow is any part of the language in which a branch occurs. \r\n+A branch is in this case a change in which instruction happens next. \r\n+These come in 3 variations: primitives, choice and loops.\r\n+C, C\\#, Java etc contain some or all of these elements to control the flow of a program:\r\n+\r\n+\\begin{itemize}\r\n+    \\item \\texttt{if/if-else}\r\n+    \\item \\texttt{?:} (Ternary operator)\r\n+    \\item \\texttt{switch}\r\n+    \\item \\texttt{while}\r\n+    \\item \\texttt{for}\r\n+    \\item \\texttt{foreach}\r\n+    \\item \\texttt{do..while}\r\n+    \\item \\texttt{goto}\r\n+\\end{itemize}\r\n+\r\n+If a programming language has if, goto and label then the other constructs can be made.\r\n+For example a while-loop can be translated to a if and goto, this is shown in \\myref{ifgotowhile1} and \\myref{ifgotowhile2} written in C. \r\n+\r\n+\\noindent\\begin{minipage}{.45\\textwidth}\r\n+\\begin{lstlisting}[caption=Loop made with while.,frame=tlrb, label=ifgotowhile1, numbers=none]{Name}\r\n+while ( condition )\r\n+{\r\n+    statement();\r\n+}\r\n+\\end{lstlisting}\r\n+\\end{minipage}\\hfill\r\n+\\begin{minipage}{.45\\textwidth}\r\n+\\begin{lstlisting}[caption=The same loop with if and goto.,frame=tlrb, label=ifgotowhile2, numbers=none]{Name}\r\n+label startOfLoop:\r\n+if ( condition )\r\n+{\r\n+    statement();\r\n+    goto startOfLoop;\r\n+}\r\n+\\end{lstlisting}\r\n+\\end{minipage}\r\n+\r\n+The same can be done with the \\texttt{for} and \\texttt{do..while} loops. \r\n+This means that the only need control structures should be \\texttt{if} and \\texttt{goto}. \r\n+However the use of goto is considered harmful, because it is easy to make mistakes when using it. \\citep{DijkstraGoto}\r\n+Even though \\texttt{for} and \\texttt{while} are very similar, they are often used in different contexts.\r\n+The for loop is very useful for iterating over a collection or knowing exactly how many time the code is executed. \r","path":"sections/subsections/controlflow2.tex","position":44,"original_position":44,"commit_id":"963b5feecbac00a331eaebd9894f3643b89e72a3","original_commit_id":"2c072b5b9f0e48a2ae3c24907b7827719fd6fe17","user":{"login":"TriXXeD","id":6638014,"avatar_url":"https://avatars.githubusercontent.com/u/6638014?v=3","gravatar_id":"","url":"https://api.github.com/users/TriXXeD","html_url":"https://github.com/TriXXeD","followers_url":"https://api.github.com/users/TriXXeD/followers","following_url":"https://api.github.com/users/TriXXeD/following{/other_user}","gists_url":"https://api.github.com/users/TriXXeD/gists{/gist_id}","starred_url":"https://api.github.com/users/TriXXeD/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TriXXeD/subscriptions","organizations_url":"https://api.github.com/users/TriXXeD/orgs","repos_url":"https://api.github.com/users/TriXXeD/repos","events_url":"https://api.github.com/users/TriXXeD/events{/privacy}","received_events_url":"https://api.github.com/users/TriXXeD/received_events","type":"User","site_admin":false},"body":"Fjern very","created_at":"2015-03-13T12:38:14Z","updated_at":"2015-03-13T12:38:14Z","html_url":"https://github.com/SW413/Paper/pull/17#discussion_r26381986","pull_request_url":"https://api.github.com/repos/SW413/Paper/pulls/17","_links":{"self":{"href":"https://api.github.com/repos/SW413/Paper/pulls/comments/26381986"},"html":{"href":"https://github.com/SW413/Paper/pull/17#discussion_r26381986"},"pull_request":{"href":"https://api.github.com/repos/SW413/Paper/pulls/17"}}},"pull_request":{"url":"https://api.github.com/repos/SW413/Paper/pulls/17","id":31111416,"html_url":"https://github.com/SW413/Paper/pull/17","diff_url":"https://github.com/SW413/Paper/pull/17.diff","patch_url":"https://github.com/SW413/Paper/pull/17.patch","issue_url":"https://api.github.com/repos/SW413/Paper/issues/17","number":17,"state":"open","locked":false,"title":"Design afsnit","user":{"login":"Quazaka","id":6616239,"avatar_url":"https://avatars.githubusercontent.com/u/6616239?v=3","gravatar_id":"","url":"https://api.github.com/users/Quazaka","html_url":"https://github.com/Quazaka","followers_url":"https://api.github.com/users/Quazaka/followers","following_url":"https://api.github.com/users/Quazaka/following{/other_user}","gists_url":"https://api.github.com/users/Quazaka/gists{/gist_id}","starred_url":"https://api.github.com/users/Quazaka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Quazaka/subscriptions","organizations_url":"https://api.github.com/users/Quazaka/orgs","repos_url":"https://api.github.com/users/Quazaka/repos","events_url":"https://api.github.com/users/Quazaka/events{/privacy}","received_events_url":"https://api.github.com/users/Quazaka/received_events","type":"User","site_admin":false},"body":"Compiler, men der er problemer med myref / ref. \r\nSkal læses igennem og rettes.","created_at":"2015-03-13T09:41:11Z","updated_at":"2015-03-13T12:38:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7a22777c0112510fdc6ceb11f4db5e878dd87f38","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/SW413/Paper/pulls/17/commits","review_comments_url":"https://api.github.com/repos/SW413/Paper/pulls/17/comments","review_comment_url":"https://api.github.com/repos/SW413/Paper/pulls/comments{/number}","comments_url":"https://api.github.com/repos/SW413/Paper/issues/17/comments","statuses_url":"https://api.github.com/repos/SW413/Paper/statuses/963b5feecbac00a331eaebd9894f3643b89e72a3","head":{"label":"SW413:design","ref":"design","sha":"963b5feecbac00a331eaebd9894f3643b89e72a3","user":{"login":"SW413","id":11027586,"avatar_url":"https://avatars.githubusercontent.com/u/11027586?v=3","gravatar_id":"","url":"https://api.github.com/users/SW413","html_url":"https://github.com/SW413","followers_url":"https://api.github.com/users/SW413/followers","following_url":"https://api.github.com/users/SW413/following{/other_user}","gists_url":"https://api.github.com/users/SW413/gists{/gist_id}","starred_url":"https://api.github.com/users/SW413/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SW413/subscriptions","organizations_url":"https://api.github.com/users/SW413/orgs","repos_url":"https://api.github.com/users/SW413/repos","events_url":"https://api.github.com/users/SW413/events{/privacy}","received_events_url":"https://api.github.com/users/SW413/received_events","type":"Organization","site_admin":false},"repo":{"id":30863136,"name":"Paper","full_name":"SW413/Paper","owner":{"login":"SW413","id":11027586,"avatar_url":"https://avatars.githubusercontent.com/u/11027586?v=3","gravatar_id":"","url":"https://api.github.com/users/SW413","html_url":"https://github.com/SW413","followers_url":"https://api.github.com/users/SW413/followers","following_url":"https://api.github.com/users/SW413/following{/other_user}","gists_url":"https://api.github.com/users/SW413/gists{/gist_id}","starred_url":"https://api.github.com/users/SW413/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SW413/subscriptions","organizations_url":"https://api.github.com/users/SW413/orgs","repos_url":"https://api.github.com/users/SW413/repos","events_url":"https://api.github.com/users/SW413/events{/privacy}","received_events_url":"https://api.github.com/users/SW413/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/SW413/Paper","description":"This is our paper, maybe we should call it A4.","fork":false,"url":"https://api.github.com/repos/SW413/Paper","forks_url":"https://api.github.com/repos/SW413/Paper/forks","keys_url":"https://api.github.com/repos/SW413/Paper/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SW413/Paper/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SW413/Paper/teams","hooks_url":"https://api.github.com/repos/SW413/Paper/hooks","issue_events_url":"https://api.github.com/repos/SW413/Paper/issues/events{/number}","events_url":"https://api.github.com/repos/SW413/Paper/events","assignees_url":"https://api.github.com/repos/SW413/Paper/assignees{/user}","branches_url":"https://api.github.com/repos/SW413/Paper/branches{/branch}","tags_url":"https://api.github.com/repos/SW413/Paper/tags","blobs_url":"https://api.github.com/repos/SW413/Paper/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SW413/Paper/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SW413/Paper/git/refs{/sha}","trees_url":"https://api.github.com/repos/SW413/Paper/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SW413/Paper/statuses/{sha}","languages_url":"https://api.github.com/repos/SW413/Paper/languages","stargazers_url":"https://api.github.com/repos/SW413/Paper/stargazers","contributors_url":"https://api.github.com/repos/SW413/Paper/contributors","subscribers_url":"https://api.github.com/repos/SW413/Paper/subscribers","subscription_url":"https://api.github.com/repos/SW413/Paper/subscription","commits_url":"https://api.github.com/repos/SW413/Paper/commits{/sha}","git_commits_url":"https://api.github.com/repos/SW413/Paper/git/commits{/sha}","comments_url":"https://api.github.com/repos/SW413/Paper/comments{/number}","issue_comment_url":"https://api.github.com/repos/SW413/Paper/issues/comments{/number}","contents_url":"https://api.github.com/repos/SW413/Paper/contents/{+path}","compare_url":"https://api.github.com/repos/SW413/Paper/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SW413/Paper/merges","archive_url":"https://api.github.com/repos/SW413/Paper/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SW413/Paper/downloads","issues_url":"https://api.github.com/repos/SW413/Paper/issues{/number}","pulls_url":"https://api.github.com/repos/SW413/Paper/pulls{/number}","milestones_url":"https://api.github.com/repos/SW413/Paper/milestones{/number}","notifications_url":"https://api.github.com/repos/SW413/Paper/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SW413/Paper/labels{/name}","releases_url":"https://api.github.com/repos/SW413/Paper/releases{/id}","created_at":"2015-02-16T10:18:37Z","updated_at":"2015-03-13T10:20:29Z","pushed_at":"2015-03-13T12:33:47Z","git_url":"git://github.com/SW413/Paper.git","ssh_url":"git@github.com:SW413/Paper.git","clone_url":"https://github.com/SW413/Paper.git","svn_url":"https://github.com/SW413/Paper","homepage":null,"size":972,"stargazers_count":0,"watchers_count":0,"language":"TeX","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":6,"forks":0,"open_issues":6,"watchers":0,"default_branch":"master"}},"base":{"label":"SW413:master","ref":"master","sha":"74e93e6c1fa24875e791e25c6581c9a5ec93addf","user":{"login":"SW413","id":11027586,"avatar_url":"https://avatars.githubusercontent.com/u/11027586?v=3","gravatar_id":"","url":"https://api.github.com/users/SW413","html_url":"https://github.com/SW413","followers_url":"https://api.github.com/users/SW413/followers","following_url":"https://api.github.com/users/SW413/following{/other_user}","gists_url":"https://api.github.com/users/SW413/gists{/gist_id}","starred_url":"https://api.github.com/users/SW413/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SW413/subscriptions","organizations_url":"https://api.github.com/users/SW413/orgs","repos_url":"https://api.github.com/users/SW413/repos","events_url":"https://api.github.com/users/SW413/events{/privacy}","received_events_url":"https://api.github.com/users/SW413/received_events","type":"Organization","site_admin":false},"repo":{"id":30863136,"name":"Paper","full_name":"SW413/Paper","owner":{"login":"SW413","id":11027586,"avatar_url":"https://avatars.githubusercontent.com/u/11027586?v=3","gravatar_id":"","url":"https://api.github.com/users/SW413","html_url":"https://github.com/SW413","followers_url":"https://api.github.com/users/SW413/followers","following_url":"https://api.github.com/users/SW413/following{/other_user}","gists_url":"https://api.github.com/users/SW413/gists{/gist_id}","starred_url":"https://api.github.com/users/SW413/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SW413/subscriptions","organizations_url":"https://api.github.com/users/SW413/orgs","repos_url":"https://api.github.com/users/SW413/repos","events_url":"https://api.github.com/users/SW413/events{/privacy}","received_events_url":"https://api.github.com/users/SW413/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/SW413/Paper","description":"This is our paper, maybe we should call it A4.","fork":false,"url":"https://api.github.com/repos/SW413/Paper","forks_url":"https://api.github.com/repos/SW413/Paper/forks","keys_url":"https://api.github.com/repos/SW413/Paper/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SW413/Paper/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SW413/Paper/teams","hooks_url":"https://api.github.com/repos/SW413/Paper/hooks","issue_events_url":"https://api.github.com/repos/SW413/Paper/issues/events{/number}","events_url":"https://api.github.com/repos/SW413/Paper/events","assignees_url":"https://api.github.com/repos/SW413/Paper/assignees{/user}","branches_url":"https://api.github.com/repos/SW413/Paper/branches{/branch}","tags_url":"https://api.github.com/repos/SW413/Paper/tags","blobs_url":"https://api.github.com/repos/SW413/Paper/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SW413/Paper/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SW413/Paper/git/refs{/sha}","trees_url":"https://api.github.com/repos/SW413/Paper/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SW413/Paper/statuses/{sha}","languages_url":"https://api.github.com/repos/SW413/Paper/languages","stargazers_url":"https://api.github.com/repos/SW413/Paper/stargazers","contributors_url":"https://api.github.com/repos/SW413/Paper/contributors","subscribers_url":"https://api.github.com/repos/SW413/Paper/subscribers","subscription_url":"https://api.github.com/repos/SW413/Paper/subscription","commits_url":"https://api.github.com/repos/SW413/Paper/commits{/sha}","git_commits_url":"https://api.github.com/repos/SW413/Paper/git/commits{/sha}","comments_url":"https://api.github.com/repos/SW413/Paper/comments{/number}","issue_comment_url":"https://api.github.com/repos/SW413/Paper/issues/comments{/number}","contents_url":"https://api.github.com/repos/SW413/Paper/contents/{+path}","compare_url":"https://api.github.com/repos/SW413/Paper/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SW413/Paper/merges","archive_url":"https://api.github.com/repos/SW413/Paper/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SW413/Paper/downloads","issues_url":"https://api.github.com/repos/SW413/Paper/issues{/number}","pulls_url":"https://api.github.com/repos/SW413/Paper/pulls{/number}","milestones_url":"https://api.github.com/repos/SW413/Paper/milestones{/number}","notifications_url":"https://api.github.com/repos/SW413/Paper/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SW413/Paper/labels{/name}","releases_url":"https://api.github.com/repos/SW413/Paper/releases{/id}","created_at":"2015-02-16T10:18:37Z","updated_at":"2015-03-13T10:20:29Z","pushed_at":"2015-03-13T12:33:47Z","git_url":"git://github.com/SW413/Paper.git","ssh_url":"git@github.com:SW413/Paper.git","clone_url":"https://github.com/SW413/Paper.git","svn_url":"https://github.com/SW413/Paper","homepage":null,"size":972,"stargazers_count":0,"watchers_count":0,"language":"TeX","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":6,"forks":0,"open_issues":6,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/SW413/Paper/pulls/17"},"html":{"href":"https://github.com/SW413/Paper/pull/17"},"issue":{"href":"https://api.github.com/repos/SW413/Paper/issues/17"},"comments":{"href":"https://api.github.com/repos/SW413/Paper/issues/17/comments"},"review_comments":{"href":"https://api.github.com/repos/SW413/Paper/pulls/17/comments"},"review_comment":{"href":"https://api.github.com/repos/SW413/Paper/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/SW413/Paper/pulls/17/commits"},"statuses":{"href":"https://api.github.com/repos/SW413/Paper/statuses/963b5feecbac00a331eaebd9894f3643b89e72a3"}}}}