{"id":135,"date":"2009-01-26T05:53:09","date_gmt":"2009-01-26T03:53:09","guid":{"rendered":"http:\/\/www.binaryvision.org.il\/?p=135"},"modified":"2009-03-14T16:52:52","modified_gmt":"2009-03-14T14:52:52","slug":"%d7%94%d7%90%d7%9d-goto-%d7%91%d7%90%d7%9e%d7%aa-%d7%a9%d7%98%d7%a0%d7%99","status":"publish","type":"post","link":"https:\/\/www.binaryvision.co.il\/2009\/01\/%d7%94%d7%90%d7%9d-goto-%d7%91%d7%90%d7%9e%d7%aa-%d7%a9%d7%98%d7%a0%d7%99\/","title":{"rendered":"\u05d4\u05d0\u05dd goto \u05d1\u05d0\u05de\u05ea \u05e9\u05d8\u05e0\u05d9?"},"content":{"rendered":"

\u05de\u05d1\u05d5\u05d0<\/strong>
\n\u05d9\u05e9 \u05db\u05dc \u05de\u05d9\u05e0\u05d9 "\u05e9\u05d9\u05d8\u05d5\u05ea" \u05ea\u05db\u05e0\u05d5\u05ea, \u05d9\u05e9 \u05d0\u05e0\u05e9\u05d9\u05dd \u05e9\u05de\u05ea\u05db\u05e0\u05ea\u05d9\u05dd "\u05e4\u05e8\u05d5\u05e6\u05d3\u05d5\u05e8\u05d0\u05dc\u05d9", \u05d9\u05e9 \u05d0\u05e0\u05e9\u05d9\u05dd \u05e9\u05de\u05ea\u05db\u05e0\u05ea\u05d9\u05dd "\u05de\u05d5\u05e0\u05d7\u05d4 \u05e2\u05e6\u05de\u05d9\u05dd", \u05d9\u05e9 \u05d0\u05e0\u05e9\u05d9\u05dd \u05e9\u05de\u05e2\u05d3\u05d9\u05e4\u05d9\u05dd \u05d0\u05d1\u05e1\u05d8\u05e8\u05e7\u05d8\u05d9\u05d5\u05ea \u05d5\u05d9\u05e9 \u05d0\u05e0\u05e9\u05d9\u05dd \u05e9\u05dc\u05d0. \u05e7\u05d9\u05d9\u05de\u05d5\u05ea \u05d4\u05e8\u05d1\u05d4 \u05d8\u05e2\u05e0\u05d5\u05ea \u05d1\u05e2\u05d3 \u05d5\u05e0\u05d2\u05d3 \u05db\u05dc \u05d0\u05d7\u05ea \u05de\u05d4\u05e9\u05d9\u05d8\u05d5\u05ea, \u05d9\u05e9\u05e0\u05d4 \u05d4\u05e1\u05db\u05de\u05d4 \u05e9\u05d7\u05dc\u05e7 \u05de\u05d4\u05e9\u05d9\u05d8\u05d5\u05ea \u05e0\u05db\u05d5\u05e0\u05d5\u05ea \u05d9\u05d5\u05ea\u05e8 \u05dc\u05de\u05e7\u05e8\u05d9\u05dd \u05de\u05e1\u05d5\u05d9\u05d9\u05de\u05d9\u05dd, \u05d5\u05d7\u05dc\u05e7 \u05dc\u05d0\u05d7\u05e8\u05d9\u05dd, \u05d1\u05e7\u05d9\u05e6\u05d5\u05e8, \u05db\u05d5\u05dc\u05dd \u05de\u05e1\u05db\u05d9\u05de\u05d9\u05dd \u05e9\u05d0\u05d9\u05df \u05e9\u05d9\u05d8\u05d4 \u05d0\u05d7\u05ea \u05de\u05d5\u05e9\u05dc\u05de\u05ea, \u05d0\u05d5 \u05dc\u05d7\u05dc\u05d5\u05e4\u05d9\u05df, \u05e0\u05d5\u05e8\u05d0\u05d9\u05ea. \u05d0\u05d5\u05dc\u05dd, \u05d9\u05e9\u05e0\u05d4 \u05d4\u05e1\u05db\u05de\u05d4 \u05e9 goto \u05d4\u05d5\u05d0 \u05e9\u05dc\u05d9\u05d7\u05d5 \u05e9\u05dc \u05d4\u05e9\u05d8\u05df \u05dc\u05e2\u05d5\u05dc\u05dd \u05d4\u05ea\u05d9\u05db\u05e0\u05d5\u05ea.<\/p>\n

\u05dc\u05d0\u05dc\u05d4 \u05de\u05db\u05dd \u05e9\u05dc\u05d0 \u05d9\u05d5\u05d3\u05e2\u05d9\u05dd goto \u05d6\u05d5 \u05e7\u05e4\u05d9\u05e6\u05d4 \u05d1\u05dc\u05ea\u05d9 \u05de\u05d5\u05ea\u05e0\u05d9\u05ea \u05d1 c (\u05d5\u05d3\u05d5\u05de\u05d5\u05ea\u05d9\u05d4).
\n\u05d3\u05d5\u05d2\u05de\u05d0 \u05dc\u05e9\u05d9\u05de\u05d5\u05e9 \u05d1\u05e7\u05d5\u05d3:<\/p>\n

\n  1. goto exit;\n  2. printf(\"hello world!\\n\");\n  3. exit: return 0;\n<\/pre>\n

\u05d1\u05e7\u05d5\u05d3 \u05d4\u05d6\u05d4, \u05e9\u05d5\u05e8\u05d4 2 \u05dc\u05e2\u05d5\u05dc\u05dd \u05dc\u05d0 \u05ea\u05e7\u05e8\u05d0, \u05e9\u05d5\u05e8\u05d4 1 \u05ea\u05d2\u05e8\u05d5\u05dd \u05dc\u05e7\u05e4\u05d9\u05e6\u05d4 \u05d1\u05dc\u05ea\u05d9 \u05de\u05d5\u05ea\u05e0\u05d9\u05ea (\u05e7\u05e8\u05d9: \u05ea\u05de\u05d9\u05d3) \u05dc\u05e9\u05d5\u05e8\u05d4 3, \u05d0\u05e9\u05e8 \u05ea\u05e1\u05d9\u05d9\u05dd \u05d0\u05ea \u05d4\u05e8\u05e6\u05ea \u05d4\u05e4\u05d5\u05e0\u05e7\u05e6\u05d9\u05d4.<\/p>\n


\n\u05d0\u05d6 \u05dc\u05de\u05d4 \u05d1\u05e2\u05e6\u05dd goto \u05e0\u05d7\u05e9\u05d1 \u05e8\u05e2?<\/strong>
\n\u05dc\u05e4\u05d9 \u05d3\u05e2\u05ea\u05d9 \u05d9\u05e9\u05e0\u05df \u05db\u05de\u05d4 \u05e1\u05d9\u05d1\u05d5\u05ea \u05d0\u05e4\u05e9\u05e8\u05d9\u05d5\u05ea:
\n1. goto \u05e0\u05d7\u05e9\u05d1 \u05e8\u05e2 \u05e2\u05e7\u05d1 \u05e8\u05e6\u05d5\u05df \u05e9\u05d0\u05e0\u05e9\u05d9\u05dd \u05d9\u05e9\u05ea\u05de\u05e9\u05d5 \u05d1\u05d0\u05dc\u05d8\u05e8\u05e0\u05d8\u05d9\u05d1\u05d5\u05ea \u05d4\u05d9\u05d5\u05ea\u05e8 "high level" \u05e9\u05dc\u05d5, \u05db\u05de\u05d5 for, while, if, try, etc… \u05d5\u05d1\u05e9\u05d1\u05d9\u05dc \u05e9\u05d0\u05e0\u05e9\u05d9\u05dd \u05d1\u05d0\u05de\u05ea \u05d9\u05e9\u05ea\u05de\u05e9\u05d5 \u05d1\u05d4\u05dd, \u05d4\u05ea\u05d7\u05d9\u05dc\u05d5 \u05dc\u05d4\u05e2\u05dc\u05d9\u05dc \u05e2\u05dc goto.
\n\u05d4\u05e0\u05d4 \u05dc\u05d3\u05d5\u05d2\u05de\u05d0 \u05e7\u05d5\u05d3 \u05d1 goto (\u05e1\u05d8\u05d9\u05d9\u05dc \u05d0\u05e1\u05de\u05d1\u05dc\u05d9) \u05d5\u05e7\u05d5\u05d3 \u05e2\u05dd for:<\/p>\n

\n  for (i=0; i<5 ; i++)\n  \tprint(\"hi\");\n<\/pre>\n

\u05dc\u05e2\u05d5\u05de\u05ea \u05d4\u05e7\u05d5\u05d3 \u05e2\u05dd goto:<\/p>\n

\n  i=0;\n  \n  start:\n  if (i<5) \n  \n  print (\"hi\");\n  \n  i++;\n  goto start;\n  \n  exit:\n<\/pre>\n

2. \u05d9\u05d5\u05ea\u05e8 \u05de\u05d9\u05d3\u05d9 \u05d0\u05e0\u05e9\u05d9\u05dd \u05e9\u05d4\u05d9\u05d5 \u05e8\u05d2\u05d9\u05dc\u05d9\u05dd \u05dc\u05d0\u05e1\u05de\u05d1\u05dc\u05d9 \u05e9\u05e9\u05dd \u05d0\u05e4\u05e9\u05e8 \u05dc\u05e2\u05e9\u05d5\u05ea \u05e9\u05d8\u05d5\u05d9\u05d5\u05ea \u05e2\u05dd goto \u05e9\u05d0\u05d9 \u05d0\u05e4\u05e9\u05e8 \u05dc\u05e2\u05e9\u05d5\u05ea \u05d1 c, \u05dc\u05d3\u05d5\u05d2\u05de\u05d0 "\u05e7\u05e4\u05d9\u05e6\u05d5\u05ea \u05e8\u05d7\u05d5\u05e7\u05d5\u05ea" \u05d4\u05d7\u05dc\u05d9\u05d8\u05d5 \u05e9\u05dc\u05d0 \u05e8\u05d5\u05e6\u05d9\u05dd \u05d1\u05dc\u05d0\u05d2\u05df \u05d1\u05e7\u05d5\u05d3 \u05e9\u05dc\u05d4\u05dd, \u05d5\u05dc\u05db\u05df \u05e6\u05e8\u05d9\u05da \u05d2\u05d9\u05e9\u05d4 \u05d7\u05d3\u05e9\u05d4, \u05e0\u05d8\u05d5\u05dc\u05ea goto.
\n\u05d4\u05e0\u05d4 \u05e7\u05d5\u05d3 \u05e9\u05dc\u05d0 \u05d0\u05e4\u05e9\u05e8\u05d9 \u05d1 c \u05d0\u05d1\u05dc \u05d6\u05d5 \u05d4\u05d2\u05d9\u05e9\u05d4 \u05d4\u05de\u05d3\u05d5\u05d1\u05e8\u05ea \u05d5\u05d4\u05de\u05de\u05e9 \u05de\u05e2\u05e6\u05d1\u05e0\u05ea \u05dc\u05e2\u05e7\u05d9\u05d1\u05d4:<\/p>\n

\n  int\n  foo (int i) \n  {\n  \tgoto a;\t\n  \treturn 0;\n  }\n  \n  int\n  bar (int j)\n  {\n  a:\t\n  \tprint(\"hi\");\n  \treturn 0;\n  }\n<\/pre>\n

3. \u05d1\u05e2\u05e6\u05dd \u05d0\u05e0\u05e9\u05d9\u05dd \u05e2\u05e9\u05d5 \u05d1\u05dc\u05d0\u05d2\u05df \u05e2\u05dd goto \u05d1\u05e2\u05d1\u05e8 \u05d4\u05e8\u05d7\u05d5\u05e7 \u05d5\u05d0\u05d6 \u05d0\u05e0\u05e9\u05d9\u05dd \u05d4\u05ea\u05e8\u05d2\u05dc\u05d5 \u05dc\u05e8\u05d0\u05d5\u05ea goto \u05d5\u05dc\u05d1\u05e8\u05d5\u05d7 \u05d1\u05d6\u05d5\u05d5\u05e2\u05d4.
\n\u05dc\u05d3\u05d5\u05d2\u05de\u05d0:<\/p>\n

\n  while (i<6) {\n  start:\n  \tfor (j=0; j<5; j++) {\n  \t\tif (j==3)\n  \t\t\tgoto start;\n  \t}\n  \ti++;\n  }\n<\/pre>\n

\u05dc\u05de\u05d4 \u05db\u05df<\/strong>
\n\u05db\u05dc \u05d0\u05d7\u05ea \u05de\u05d4\u05e1\u05d9\u05d1\u05d5\u05ea \u05d4\u05d0\u05dc\u05d4 \u05d4\u05d2\u05d9\u05d5\u05e0\u05d9\u05ea \u05d5\u05d0\u05e4\u05e9\u05e8\u05d9\u05ea \u05d0\u05d1\u05dc \u05d4\u05d0\u05dd \u05d4\u05df \u05de\u05e1\u05e4\u05e7\u05d5\u05ea? \u05d4\u05e8\u05d9 \u05d0\u05e4\u05e9\u05e8 \u05dc\u05d4\u05ea\u05e2\u05dc\u05dc \u05d1\u05e2\u05d5\u05d3 \u05d4\u05e8\u05d1\u05d4 \u05e4\u05e7\u05d5\u05d3\u05d5\u05ea \u05d1 C \u05d0\u05dd \u05dc\u05d0 \u05e2\u05d5\u05e9\u05d9\u05dd \u05d3\u05d1\u05e8\u05d9\u05dd \u05e0\u05db\u05d5\u05df. \u05d6\u05d4 \u05db\u05de\u05d5 \u05dc\u05d0\u05e1\u05d5\u05e8 \u05dc\u05d4\u05e9\u05ea\u05de\u05e9 \u05d1\u05de\u05e6\u05d1\u05d9\u05e2\u05d9\u05dd \u05dc void \u05d4\u05e8\u05d9 \u05e2\u05dd \u05e9\u05d9\u05de\u05d5\u05e9 \u05d1\u05de\u05e6\u05d1\u05d9\u05e2\u05d9\u05dd \u05db\u05d0\u05dc\u05d4 \u05d0\u05d9\u05df type checking \u05d1\u05d7\u05dc\u05e7 \u05de\u05d4\u05de\u05e7\u05d5\u05de\u05d5\u05ea \u05d5\u05d6\u05d4 \u05d9\u05db\u05d5\u05dc \u05dc\u05d4\u05d5\u05d1\u05d9\u05dc \u05dc\u05e9\u05d2\u05d9\u05d0\u05d5\u05ea. \u05d6\u05d4 \u05e4\u05e9\u05d5\u05d8 \u05dc\u05d0 \u05d4\u05d2\u05d9\u05d5\u05e0\u05d9!<\/p>\n

\u05dc\u05e2\u05d5\u05de\u05ea \u05d4\u05d8\u05e2\u05e0\u05d5\u05ea \u05d4\u05d7\u05dc\u05e9\u05d5\u05ea \u05e0\u05d2\u05d3 goto \u05d9\u05e9 \u05d8\u05e2\u05e0\u05d5\u05ea \u05d7\u05d6\u05e7\u05d5\u05ea \u05d1\u05e2\u05d3:
\n1. \u05d0\u05e0\u05e9\u05d9\u05dd \u05de\u05e9\u05ea\u05de\u05e9\u05d9\u05dd \u05d1 goto (\u05d1\u05dc\u05d9 \u05dc\u05d3\u05e2\u05ea) \u05db\u05dc \u05d4\u05d6\u05de\u05df.
\n2. goto \u05e2\u05d5\u05d6\u05e8 \u05de\u05d0\u05d5\u05d3 \u05d1\u05db\u05dc \u05de\u05d9\u05e0\u05d9 \u05de\u05e7\u05e8\u05d9\u05dd.<\/p>\n

\u05e1\u05d9\u05e0\u05d8\u05e7\u05e1 \u05e7\u05d9\u05d9\u05dd \u05e9\u05e4\u05d5\u05e2\u05dc \u05db\u05de\u05d5 goto<\/strong>
\n1. break \u05d5 continue \u05d6\u05d4 goto \u05e9\u05e2\u05d8\u05e4\u05d5 \u05d0\u05d5\u05ea\u05d5 \u05de\u05e2\u05d8! \u05d4\u05e8\u05d9 \u05d1\u05e7\u05dc\u05d5\u05ea \u05d0\u05e4\u05e9\u05e8 \u05dc\u05de\u05de\u05e9 \u05d0\u05ea \u05e9\u05e0\u05d9\u05d4\u05dd \u05d1\u05e2\u05d6\u05e8\u05ea goto:<\/p>\n

\n  while (true) {\n  \tif (i>1)\n  \t\tcontinue;\n  \telse\n  \t\tbreak;\n  }\n<\/pre>\n

\u05d5\u05e2\u05dd goto:<\/p>\n

\n  while (true) {\n  next:\n  \tif (i>1)\n  \t\tgoto next;\n  \telse\n  \t\tgoto end;\n  }\n  end:\n<\/pre>\n

\u05d5\u05d4\u05de\u05d9\u05de\u05d5\u05e9 \u05e2\u05dd \u05dc\u05d5\u05dc\u05d0\u05d5\u05ea for \u05dc\u05d0 \u05e9\u05d5\u05e0\u05d4 \u05d1\u05d4\u05e8\u05d1\u05d4!<\/p>\n

\u05de\u05d4 \u05d1\u05e0\u05d5\u05d2\u05e2 \u05dc try and catch? (\u05db\u05df, \u05d0\u05e0\u05d9 \u05d9\u05d5\u05d3\u05e2 \u05e9\u05d6\u05d4 c++)<\/p>\n

\n  try {\n  \tif (error) {\n  \t\tthrow \"error!\";\n  \t}\n  }\n  catch (char * str) {\n  \tprintf(\"%s\\n\", str);\n  }\n<\/pre>\n

\u05dc\u05e2\u05d5\u05de\u05ea:<\/p>\n

\n  if (error) {\n  \tstr = \"error!\";\n  }\n  else {\n  \tgoto cont;\n  }\n  \n  \/* catch *\/\n  error:\n  printf(\"%s\\n\", str);\n  \n  cont:\n<\/pre>\n

\u05d0\u05d6 \u05e0\u05db\u05d5\u05df, \u05dc\u05d4\u05e9\u05ea\u05de\u05e9 \u05d1\u05e1\u05d9\u05e0\u05d8\u05e7\u05e1 \u05d4\u05e7\u05d9\u05d9\u05dd \u05d9\u05d5\u05ea\u05e8 \u05e0\u05e7\u05d9, \u05d5\u05d1\u05d8\u05d7 \u05de\u05e8\u05d2\u05d9\u05e9 \u05d9\u05d5\u05ea\u05e8 \u05e0\u05db\u05d5\u05df, \u05d0\u05d1\u05dc \u05d4\u05d5\u05d0 \u05d4\u05ea\u05d7\u05d9\u05dc \u05db goto \u05e1\u05ea\u05dd \u05e2\u05d8\u05e4\u05d5 \u05d0\u05d5\u05ea\u05d5 \u05d9\u05e4\u05d4, \u05d5\u05d0\u05dd \u05d4\u05d5\u05d0 \u05d1\u05e2\u05e6\u05dd \u05de\u05ea\u05e0\u05d4\u05d2 \u05db\u05de\u05d5 goto, \u05d0\u05d6 \u05d4\u05e8\u05d9 \u05d1\u05d8\u05d7 \u05d9\u05e9 \u05dc\u05d5 \u05d0\u05ea \u05d0\u05d5\u05ea\u05df \u05ea\u05db\u05d5\u05e0\u05d5\u05ea \u05e9\u05d8\u05e0\u05d9\u05d5\u05ea…
\n\u05d4\u05e1\u05d9\u05e0\u05d8\u05e7\u05e1\u05d8\u05d9\u05dd \u05e9\u05e0\u05ea\u05ea\u05d9 \u05de\u05d2\u05d1\u05d9\u05dc\u05d9\u05dd \u05d0\u05ea \u05d4\u05de\u05ea\u05db\u05e0\u05ea \u05dc\u05d0 \u05dc\u05e2\u05e9\u05d5\u05ea \u05e9\u05d8\u05d5\u05d9\u05d5\u05ea \u05de\u05d5\u05d2\u05d6\u05de\u05d5\u05ea, \u05d0\u05d1\u05dc \u05e2"\u05d9 \u05db\u05ea\u05d9\u05d1\u05d4 \u05e0\u05db\u05d5\u05e0\u05d4 \u05d2\u05dd \u05e2\u05dd goto \u05d0\u05e4\u05e9\u05e8 \u05dc\u05e2\u05e9\u05d5\u05ea \u05e7\u05d5\u05d3 \u05e0\u05e7\u05d9 \u05d5\u05de\u05d5\u05d1\u05df.
\n
\n\u05e9\u05d9\u05de\u05d5\u05e9\u05d9\u05dd \u05e0\u05db\u05d5\u05e0\u05d9\u05dd:<\/strong>
\n\u05d0\u05e0\u05d9 \u05dc\u05d3\u05d5\u05d2\u05de\u05d0 \u05de\u05e9\u05ea\u05de\u05e9 \u05d1 goto \u05e8\u05e7 \u05d1\u05e9\u05d9\u05de\u05d5\u05e9 \u05d0\u05d7\u05d3 (\u05d0\u05e0\u05d9 \u05d7\u05d9\u05d9\u05d1 \u05dc\u05d4\u05d5\u05d3\u05d5\u05ea \u05e9\u05e7\u05d9\u05d1\u05dc\u05ea\u05d9 \u05d4\u05e9\u05e8\u05d0\u05d4 \u05de\u05d4\u05e7\u05d5\u05d3 \u05e9\u05dc \u05d4\u05e7\u05e8\u05e0\u05dc…) \u05e0\u05d9\u05e7\u05d5\u05d9 \u05e4\u05d5\u05e0\u05e7\u05e6\u05d9\u05d9\u05d4 \u05d0\u05d7\u05e8\u05d9 \u05e9\u05d2\u05d9\u05d0\u05d4:
\n\u05dc\u05d3\u05d5\u05d2\u05de\u05d0 \u05dc\u05dc\u05d0 \u05e9\u05d9\u05de\u05d5\u05e9 \u05d1 goto:<\/p>\n

\n  int\n  foo (int i)\n  {\n  \tchar *a;\n  \tchar *b;\n  \tchar *c;\n  \n  \ta = malloc(5);\n  \tif (a == null) \n  \t\treturn -1;\n  \n  \tb = malloc(6);\n  \tif (b == null) {\n  \t\tfree(a);\n  \t\treturn -1;\n  \t}\n  \t\n  \tc = malloc(7);\n  \tif (c == null) {\n  \t\tfree(a);\n  \t\tfree(b);\n  \t\treturn -1;\n  \t}\n  \treturn 0;\n  }\n<\/pre>\n

\u05dc\u05e2\u05d5\u05de\u05ea \u05e0\u05d9\u05e7\u05d9\u05d5\u05df \u05d1\u05e2\u05d6\u05e8\u05ea goto:<\/p>\n

\n  int\n  foo (int i)\n  {\n  \tint ret=0;\n  \tchar *a;\n  \tchar *b;\n  \tchar *c;\n  \n  \ta = malloc(5);\n  \tif (a == null) \n  \t\tgoto errora;\n  \n  \tb = malloc(6);\n  \tif (b == null) \n  \t\tgoto errorb;\n  \t\n  \tc = malloc(7);\n  \tif (c == null) \n  \t\tgoto errorc;\n  \n  exit:\n  \treturn ret;\n  \n  \n\/* error handling section *\/  \n  errorc:\n  \tfree(b);\n  errorb:\n  \tfree(a);\n  errora:\n  \tret = -1;\n  \tgoto exit;\n  }\n<\/pre>\n

\u05d4\u05e0\u05d9\u05e7\u05d9\u05d5\u05df \u05d1\u05e2\u05d6\u05e8\u05ea goto \u05d9\u05d5\u05ea\u05e8 \u05e0\u05e7\u05d9, \u05e4\u05d4 "\u05e7\u05e9\u05d4" \u05d9\u05d5\u05ea\u05e8 \u05dc\u05e8\u05d0\u05d5\u05ea \u05d0\u05ea \u05d6\u05d4, \u05d0\u05d1\u05dc \u05db\u05d0\u05e9\u05e8 \u05de\u05ea\u05e2\u05e1\u05e7\u05d9\u05dd \u05e2\u05dd \u05d4\u05e8\u05d1\u05d4 \u05d6\u05db\u05e8\u05d5\u05df \u05d3\u05d9\u05e0\u05de\u05d9 \u05d0\u05d5 \u05e0\u05d9\u05e7\u05d9\u05d5\u05df \u05e9\u05e6\u05e8\u05d9\u05da \u05dc\u05e2\u05e9\u05d5\u05ea \u05dc\u05e4\u05e0\u05d9 \u05e2\u05d6\u05d9\u05d1\u05ea \u05d4\u05e4\u05d5\u05e0\u05e7\u05e6\u05d9\u05d9\u05d4, \u05dc\u05d4\u05e2\u05ea\u05d9\u05e7 \u05d0\u05ea \u05d4\u05db\u05dc \u05de\u05d7\u05d3\u05e9 \u05d6\u05d4 \u05de\u05d9\u05d5\u05ea\u05e8 \u05d5\u05d9\u05db\u05d5\u05dc \u05dc\u05d2\u05e8\u05d5\u05dd \u05dc\u05e9\u05d2\u05d9\u05d0\u05d5\u05ea, \u05db\u05db\u05d4, \u05d0\u05e4\u05e9\u05e8 \u05dc\u05d4\u05db\u05e0\u05d9\u05e1 \u05dc\u05db\u05dc \u05de\u05e7\u05d5\u05dd \u05d1\u05e7\u05d5\u05d3 \u05e9\u05d5\u05e8\u05d5\u05ea \u05e0\u05d5\u05e1\u05e4\u05d5\u05ea \u05d5\u05dc\u05d3\u05d0\u05d5\u05d2 \u05dc\u05e0\u05d9\u05e7\u05d9\u05d5\u05df \u05d1"\u05d7\u05dc\u05e7 \u05d4\u05d0\u05d9\u05e1\u05d5\u05e3".<\/p>\n

\u05e2\u05d5\u05d3 \u05d3\u05d5\u05d2\u05de\u05d0:<\/p>\n

\n  int\n  foo (int i)\n  {\n  \tint stop = 0;\n  \twhile (true) {\n  \t\twhile (true) {\n  \t\t\tif (i==3) {\n  \t\t\t\tstop = 1;\n  \t\t\t\tbreak;\n  \t\t\t}\n  \t\t}\n  \t\tif (stop)\n  \t\t\tbreak;\n  \t}\n  \t\/*more code *\/\n  }\n  \n<\/pre>\n

\u05dc\u05e2\u05d5\u05de\u05ea:<\/p>\n

\n  int\n  foo (int i)\n  {\n  \twhile (true) {\n  \t\twhile (true) {\n  \t\t\tif (i==3) \n  \t\t\t\tgoto end;\n  \t\t}\n  \t}\n  end:\n  \t\/*more code *\/\n  }\n<\/pre>\n

\u05d0\u05d5 \u05e2\u05d5\u05d3 \u05d3\u05d5\u05d2\u05de\u05d0:<\/p>\n

\n  if (a) {\n  \tif (b) {\n  \t\tif (c) {\n  \t\t\tprintf(\"a \");\n  \t\t\tprintf(\"= b = c = true\\n\");\n  \t\t}\n  \t}\n  \telse {\n  \t\tif (d) {\n  \t\t\tprintf(\"a = !b = d = true\\n\");\n  \t\t}\n  \t}\n  }\n<\/pre>\n

\u05dc\u05e2\u05d5\u05de\u05ea:<\/p>\n

\n  if (!a)\n  \tgoto end;\n  \n  if (b) {\n  \tif (! c)\n  \t\tgoto endc;\n  \n  \tprintf(\"a \");\n  \tprintf(\"= b = c = true\\n\");\n  \t\n  \tendc:\n  }\n  else {\n  \tif (! d)\n  \t\tgoto endd;\n   \t\n  \tprintf(\"a = !b = d = true\\n\");\n  \t\n  \tendd:\n  }\n  \n  end:\n<\/pre>\n

\u05e9\u05d4\u05e8\u05d1\u05d4 \u05d9\u05d5\u05ea\u05e8 \u05d1\u05e8\u05d5\u05e8 (\u05d5\u05d9\u05d5\u05ea\u05e8 \u05d7\u05e9\u05d5\u05d1, \u05de\u05d5\u05e0\u05e2 \u05d4\u05d6\u05d7\u05d5\u05ea \u05de\u05d9\u05d5\u05ea\u05e8\u05d5\u05ea!).<\/p>\n

\u05de\u05de\u05d4 \u05d1\u05db\u05dc \u05d6\u05d0\u05ea \u05e6\u05e8\u05d9\u05da \u05dc\u05d4\u05de\u05e0\u05e2<\/strong>
\n\u05db\u05de\u05d5 \u05e9\u05d0\u05de\u05e8\u05ea\u05d9, \u05d9\u05e9 \u05dcgoto \u05d9\u05ea\u05e8\u05d5\u05e0\u05d5\u05ea \u05db\u05dc \u05e2\u05d5\u05d3 \u05e0\u05de\u05e0\u05e2\u05d9\u05dd \u05de\u05db\u05de\u05d4 \u05d3\u05d1\u05e8\u05d9\u05dd \u05d7\u05e9\u05d5\u05d1\u05d9\u05dd:
\n1. \u05d1\u05dc\u05d9 \u05e7\u05e4\u05d9\u05e6\u05d5\u05ea \u05e8\u05d7\u05d5\u05e7\u05d5\u05ea (\u05d1 c \u05d1\u05de\u05d9\u05dc\u05d0 \u05d0\u05d9 \u05d0\u05e4\u05e9\u05e8, \u05d0\u05d1\u05dc \u05dc\u05de\u05e7\u05e8\u05d4 \u05e9\u05d0\u05ea\u05dd \u05dc\u05d0 \u05de\u05ea\u05db\u05e0\u05ea\u05d9\u05dd \u05d1 c). \u05dc\u05e7\u05e4\u05d5\u05e5 \u05de\u05e4\u05d5\u05e0\u05e7\u05e6\u05d9\u05d4 \u05dc\u05e4\u05d5\u05e0\u05e7\u05e6\u05d9\u05d4 \u05d6\u05d4 \u05e4\u05e1\u05d5\u05dc, \u05dc\u05d0 \u05e0\u05db\u05d5\u05df, \u05d5\u05d9\u05de\u05dc\u05d0 \u05d0\u05ea \u05d4\u05de\u05d7\u05e1\u05e0\u05d9\u05ea \u05d1\u05d6\u05d1\u05dc (\u05d7\u05d5\u05e5 \u05de\u05d6\u05d4 \u05e9\u05d6\u05d4 \u05d9\u05db\u05d5\u05dc \u05dc\u05d2\u05e8\u05d5\u05dd \u05dc\u05e9\u05d2\u05d9\u05d0\u05d5\u05ea).<\/p>\n

2. \u05d1\u05dc\u05d9 \u05e7\u05e4\u05d9\u05e6\u05d5\u05ea "\u05d0\u05d7\u05d5\u05e8\u05d4".
\n\u05dc\u05d0 \u05de\u05d5\u05de\u05dc\u05e5 \u05dc\u05db\u05ea\u05d5\u05d1 \u05e7\u05d5\u05d3 \u05e9\u05d1\u05d5 \u05d4\u05e7\u05e4\u05d9\u05e6\u05d4 \u05ea\u05d5\u05d1\u05d9\u05dc "\u05dc\u05de\u05e2\u05dc\u05d4" \u05d1\u05de\u05e2\u05dc\u05d9 \u05d4\u05e7\u05d5\u05d3, \u05db\u05dc\u05d5\u05de\u05e8 \u05dc\u05e7\u05d5\u05d3 \u05e9\u05d4\u05d5\u05e8\u05e5 \u05dc\u05e4\u05e0\u05d9 \u05d4 goto, \u05dc\u05d3\u05d5\u05d2\u05de\u05d0, \u05dc\u05d0<\/strong> \u05dc\u05e2\u05e9\u05d5\u05ea \u05d3\u05d1\u05e8 \u05db\u05d6\u05d4:<\/p>\n

\n  start:\n  \/*code*\/\n  goto start;\n<\/pre>\n

3. \u05d9\u05e9 \u05dc\u05d1\u05d7\u05d5\u05e8 \u05ea\u05d5\u05d9\u05d5\u05ea \u05d1\u05e2\u05dc\u05d5\u05ea \u05de\u05e9\u05de\u05e2\u05d5\u05ea. \u05db\u05de\u05d5 \u05e9\u05d1\u05d5\u05d7\u05e8\u05d9\u05dd \u05e9\u05de\u05d5\u05ea \u05de\u05e9\u05ea\u05e0\u05d9\u05dd \u05d5\u05e4\u05d5\u05e0\u05e7\u05e6\u05d9\u05d5\u05ea \u05d1\u05e2\u05dc\u05d5\u05ea \u05de\u05e9\u05de\u05e2\u05d5\u05ea, \u05db\u05da \u05d2\u05dd \u05e6\u05e8\u05d9\u05da \u05dc\u05d4\u05ea\u05d9\u05d9\u05d7\u05e1 \u05dc\u05ea\u05d5\u05d5\u05d9\u05d5\u05ea, \u05d4\u05df \u05e6\u05e8\u05d9\u05db\u05d5\u05ea \u05dc\u05d4\u05e1\u05d1\u05d9\u05e8 \u05d0\u05ea \u05ea\u05e4\u05e7\u05d9\u05d3\u05df \u05d1\u05e7\u05e6\u05e8\u05d4 \u05d5\u05d1\u05de\u05e7\u05e8\u05d4 \u05e9\u05e6\u05e8\u05d9\u05da, \u05d0\u05e4\u05e9\u05e8 \u05dc\u05d4\u05d5\u05e1\u05d9\u05e3 \u05ea\u05d9\u05e2\u05d5\u05d3 \u05e7\u05dc.
\n\u05e6\u05e8\u05d9\u05da \u05dc\u05e9\u05de\u05d5\u05e8 \u05e2\u05dc \u05e7\u05d5\u05e0\u05d1\u05e6\u05e0\u05d9\u05d5\u05ea \u05d1\u05d1\u05d7\u05d9\u05e8\u05ea \u05d4\u05e9\u05dd, \u05d1\u05d3\u05d9\u05d5\u05e7 \u05db\u05de\u05d5 \u05e9\u05e2\u05d5\u05e9\u05d9\u05dd \u05e2\u05dd \u05de\u05e9\u05ea\u05e0\u05d9\u05dd \u05d5\u05e4\u05d5\u05e0\u05e7\u05e6\u05d9\u05d5\u05ea.<\/p>\n

4. \u05d9\u05e9 \u05dc\u05db\u05dd \u05e2\u05d5\u05d3 \u05e8\u05e2\u05d9\u05d5\u05e0\u05d5\u05ea? \u05ea\u05db\u05ea\u05d5\u05d1 \u05d1\u05ea\u05d2\u05d5\u05d1\u05d5\u05ea…<\/p>\n

\u05d0\u05e0\u05d9 \u05de\u05e7\u05d5\u05d5\u05d4 \u05e9\u05e2\u05d3 \u05e2\u05db\u05e9\u05d9\u05d5 \u05d0\u05ea\u05dd \u05de\u05e1\u05db\u05d9\u05de\u05d9\u05dd \u05e9\u05dc goto \u05d9\u05e9 \u05de\u05e7\u05d5\u05dd \u05d1\u05e2\u05d5\u05dc\u05dd \u05d5\u05d0\u05e1\u05d5\u05e8 \u05dc\u05e4\u05e1\u05d5\u05dc \u05d0\u05d5\u05ea\u05d5 \u05e2\u05dc \u05d4\u05e1\u05e3, \u05db\u05d9 \u05d2\u05dd \u05dc\u05d5 \u05d9\u05e9 \u05e9\u05d9\u05de\u05d5\u05e9 \u05de\u05e2\u05e0\u05d9\u05d9\u05e0\u05d9\u05dd \u05d5\u05e0\u05db\u05d5\u05e0\u05d9\u05dd.<\/p>\n","protected":false},"excerpt":{"rendered":"

\u05de\u05d1\u05d5\u05d0 \u05d9\u05e9 \u05db\u05dc \u05de\u05d9\u05e0\u05d9 "\u05e9\u05d9\u05d8\u05d5\u05ea" \u05ea\u05db\u05e0\u05d5\u05ea, \u05d9\u05e9 \u05d0\u05e0\u05e9\u05d9\u05dd \u05e9\u05de\u05ea\u05db\u05e0\u05ea\u05d9\u05dd "\u05e4\u05e8\u05d5\u05e6\u05d3\u05d5\u05e8\u05d0\u05dc\u05d9", \u05d9\u05e9 \u05d0\u05e0\u05e9\u05d9\u05dd \u05e9\u05de\u05ea\u05db\u05e0\u05ea\u05d9\u05dd "\u05de\u05d5\u05e0\u05d7\u05d4 \u05e2\u05e6\u05de\u05d9\u05dd", \u05d9\u05e9 \u05d0\u05e0\u05e9\u05d9\u05dd \u05e9\u05de\u05e2\u05d3\u05d9\u05e4\u05d9\u05dd \u05d0\u05d1\u05e1\u05d8\u05e8\u05e7\u05d8\u05d9\u05d5\u05ea \u05d5\u05d9\u05e9 \u05d0\u05e0\u05e9\u05d9\u05dd \u05e9\u05dc\u05d0. \u05e7\u05d9\u05d9\u05de\u05d5\u05ea \u05d4\u05e8\u05d1\u05d4 \u05d8\u05e2\u05e0\u05d5\u05ea \u05d1\u05e2\u05d3 \u05d5\u05e0\u05d2\u05d3 \u05db\u05dc \u05d0\u05d7\u05ea \u05de\u05d4\u05e9\u05d9\u05d8\u05d5\u05ea, \u05d9\u05e9\u05e0\u05d4 \u05d4\u05e1\u05db\u05de\u05d4 \u05e9\u05d7\u05dc\u05e7 \u05de\u05d4\u05e9\u05d9\u05d8\u05d5\u05ea \u05e0\u05db\u05d5\u05e0\u05d5\u05ea \u05d9\u05d5\u05ea\u05e8 \u05dc\u05de\u05e7\u05e8\u05d9\u05dd \u05de\u05e1\u05d5\u05d9\u05d9\u05de\u05d9\u05dd, \u05d5\u05d7\u05dc\u05e7 \u05dc\u05d0\u05d7\u05e8\u05d9\u05dd, \u05d1\u05e7\u05d9\u05e6\u05d5\u05e8, \u05db\u05d5\u05dc\u05dd \u05de\u05e1\u05db\u05d9\u05de\u05d9\u05dd \u05e9\u05d0\u05d9\u05df \u05e9\u05d9\u05d8\u05d4 \u05d0\u05d7\u05ea \u05de\u05d5\u05e9\u05dc\u05de\u05ea, \u05d0\u05d5 \u05dc\u05d7\u05dc\u05d5\u05e4\u05d9\u05df, \u05e0\u05d5\u05e8\u05d0\u05d9\u05ea. \u05d0\u05d5\u05dc\u05dd, \u05d9\u05e9\u05e0\u05d4 \u05d4\u05e1\u05db\u05de\u05d4 \u05e9 goto […]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[24,25,26],"_links":{"self":[{"href":"https:\/\/www.binaryvision.co.il\/wp-json\/wp\/v2\/posts\/135"}],"collection":[{"href":"https:\/\/www.binaryvision.co.il\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.binaryvision.co.il\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.binaryvision.co.il\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.binaryvision.co.il\/wp-json\/wp\/v2\/comments?post=135"}],"version-history":[{"count":24,"href":"https:\/\/www.binaryvision.co.il\/wp-json\/wp\/v2\/posts\/135\/revisions"}],"predecessor-version":[{"id":157,"href":"https:\/\/www.binaryvision.co.il\/wp-json\/wp\/v2\/posts\/135\/revisions\/157"}],"wp:attachment":[{"href":"https:\/\/www.binaryvision.co.il\/wp-json\/wp\/v2\/media?parent=135"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.binaryvision.co.il\/wp-json\/wp\/v2\/categories?post=135"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.binaryvision.co.il\/wp-json\/wp\/v2\/tags?post=135"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}