{
    "componentChunkName": "component---src-components-layout-mdx-layout-tsx",
    "path": "/language/cheat-sheet",
    "result": {"data":{"site":{"siteMetadata":{"title":"Toit documentation"}},"mdx":{"body":"const _excluded = [\"components\"];\n\nfunction _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }\n\nfunction _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }\n\nfunction _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }\n\n/* @jsxRuntime classic */\n\n/* @jsx mdx */\nconst _frontmatter = {};\n\nconst makeShortcode = name => function MDXDefaultShortcode(props) {\n  console.warn(\"Component \" + name + \" was not imported, exported, or provided by MDXProvider as global scope\");\n  return mdx(\"div\", props);\n};\n\nconst Tabs = makeShortcode(\"Tabs\");\nconst Tab = makeShortcode(\"Tab\");\nconst layoutProps = {\n  _frontmatter\n};\nconst MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n  let {\n    components\n  } = _ref,\n      props = _objectWithoutProperties(_ref, _excluded);\n\n  return mdx(MDXLayout, _extends({}, layoutProps, props, {\n    components: components,\n    mdxType: \"MDXLayout\"\n  }), mdx(\"h1\", {\n    \"id\": \"language-comparison-cheat-sheet\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", {\n    parentName: \"h1\",\n    \"href\": \"#language-comparison-cheat-sheet\",\n    \"aria-label\": \"language comparison cheat sheet permalink\",\n    \"className\": \"table-of-contents-icon before\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"Language comparison cheat sheet\"), mdx(\"p\", null, \"Use these tables to look up familiar syntax. For explanations and runnable\\nexamples, read \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"/language/toitversus\"\n  }, \"Toit for programmers\"), \" or the guides for\\n\", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"/language/from-python\"\n  }, \"Python\"), \", \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"/language/from-cpp\"\n  }, \"C/C++\"), \", and\\n\", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"/language/from-javascript\"\n  }, \"JavaScript\"), \".\"), mdx(\"p\", null, \"The entries compare common tasks, not identical semantics. In particular,\\nToit annotations check values at runtime, only \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"false\"), \" and \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"null\"), \" are falsy,\\nand a block can return from its enclosing function. Code fragments assume\\nany required imports and enclosing declarations.\"), mdx(Tabs, {\n    noPadding: true,\n    mdxType: \"Tabs\"\n  }, mdx(Tab, {\n    label: \"Toit vs Python\",\n    mdxType: \"Tab\"\n  }, mdx(\"table\", null, mdx(\"tr\", null, mdx(\"th\", null), mdx(\"th\", null, \"Toit\"), mdx(\"th\", null, \"Python\")), mdx(\"tr\", null, mdx(\"td\", null, \"Current object\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"this\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"self\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Single line comments\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"//\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"#\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Logical 'and', 'or' and 'not' operators\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"and or not\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"and or not\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Shift left, right, unsigned right\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"<<  >>  >>>\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"<< >> (no unsigned shift)\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Integer division\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"/ (on integer types)\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"//\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Integer sizes\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"64\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"(arbitrary)\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Statement grouping\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"(indent)\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"(indent)\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Define a class Foo that inherits from Bar\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"class Foo extends Bar:\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"class Foo(Bar):\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Define constructor for class Foo\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"constructor x:\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"def __init__(self, x):\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Define constructor for class Foo that calls constructor of superclass Bar\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"constructor x:\", mdx(\"br\", null), \"\\xA0\\xA0super x\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"def __init__(self, x):\", mdx(\"br\", null), \"\\xA0\\xA0super().__init__(x)\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Constructor that assigns to fields\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"constructor .x:\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"def __init__(self, x):\", mdx(\"br\", null), \"\\xA0\\xA0self.x = x\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Check object has type\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"bar is Foo\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"isinstance(bar, Foo)\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Check object does not have type\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"bar is not Foo\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"not isinstance(bar, Foo)\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Call a method foo with two arguments\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"foo x y\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"foo(x, y)\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Declare a member variable in a class\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"x := null\", mdx(\"br\", null), \"x := ?\", mdx(\"br\", null), \"x/int := 0\", mdx(\"br\", null), \"x/int := ?\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"self.x = None  # Inside a method.\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Declare a local variable in a method\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"x := null\", mdx(\"br\", null), \"x := ?\", mdx(\"br\", null), \"x/int := 0\", mdx(\"br\", null), \"x/int := ?\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"x = None\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Define a constant\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"X ::= 0\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"X = 0  # By convention.\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Define a constant in a class\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"static X ::= 0\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"X = 0  # Class attribute, by convention.\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Define a top-level function\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"foo x y:\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"def foo(x, y):\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Define an instance method in a class\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"foo x y:\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"def foo(self, x, y):\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Define a static method in a class\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"static foo x y:\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"@staticmethod\", mdx(\"br\", null), \"def foo(x, y):\"))), mdx(\"tr\", null, mdx(\"td\", null, \"If statement\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"if condition:\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"if condition:\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Fixed loop\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"end.repeat: |i|\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"for i in range(end):\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Three-part for loop\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"for i := 0; i < end; i++:\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"Use range or a while loop.\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Iterate over collection\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"collection.do: |x|\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"for x in collection:\"))), mdx(\"tr\", null, mdx(\"td\", null, \"While loop\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"while condition:\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"while condition:\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Import local from library\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"import .library\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"from . import library  # Within a package.\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Import from library\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"import library\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"import library\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Import into current namespace\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"import library show *\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"from library import *\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Print/log\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"print \\\"Hello\\\"\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"print(\\\"Hello\\\")\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Print with interpolation\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"print \\\"Hello $name\\\"\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"print(f\\\"Hello {name}\\\")\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Interpolate with padding\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"print \\\"Hello $(%9s name)\\\"\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"print(f\\\"Hello {name:>9}\\\")\"))))), mdx(Tab, {\n    label: \"Toit vs C++\",\n    mdxType: \"Tab\"\n  }, mdx(\"table\", null, mdx(\"tr\", null, mdx(\"th\", null), mdx(\"th\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"Toit\")), mdx(\"th\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"C++\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Current object\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"this\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"this\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Single line comments\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"//\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"//\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Logical 'and', 'or' and 'not' operators\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"and or not\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"&& || ! (or and or not)\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Shift left, right, unsigned right\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"<<  >>  >>>\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"<< >> >>  (on unsigned type)\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Integer division\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"/ (on integer types)\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"/ (on integer type)\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Integer sizes\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"64\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"8/16/32/64...\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Statement grouping\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"(indent)\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"{ ... }\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Define a class Foo that inherits from Bar\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"class Foo extends Bar:\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"class Foo : public Bar {\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Define constructor for class Foo\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"constructor x:\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"Foo(int x) {\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Define constructor for class Foo that calls constructor of superclass Bar\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"constructor x:\", mdx(\"br\", null), \"\\xA0\\xA0super x\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"Foo(int x) : Bar(x) {\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Constructor that assigns to fields\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"constructor .x:\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"Foo(int x) : x(x) {\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Check object has type\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"bar is Foo\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"(dynamic_cast<Foo*>(bar) != nullptr)\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Check object does not have type\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"bar is not Foo\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"(dynamic_cast<Foo*>(bar) == nullptr)\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Call a method foo with two arguments\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"foo x y\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"foo(x, y);\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Declare a member variable in a class\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"x := null\", mdx(\"br\", null), \"x := ?\", mdx(\"br\", null), \"x/int := 0\", mdx(\"br\", null), \"x/int := ?\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"int x;\", mdx(\"br\", null), \"int x = 0;\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Declare a local variable in a method\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"x := null\", mdx(\"br\", null), \"x := ?\", mdx(\"br\", null), \"x/int := 0\", mdx(\"br\", null), \"x/int := ?\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"int x;\", mdx(\"br\", null), \"int x = 0;\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Define a constant\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"X ::= 0\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"const int X = 0;\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Define a constant in a class\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"static X ::= 0\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"static const int X = 0;\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Define a top-level function\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"foo x y:\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"int foo(int x, int y) {\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Define an instance method in a class\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"foo x y:\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"int foo(int x, int y) {\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Define a static method in a class\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"static foo x y:\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"static int foo(int x, int y) {\"))), mdx(\"tr\", null, mdx(\"td\", null, \"If statement\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"if condition:\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"if (condition) {\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Fixed loop\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"end.repeat: |i|\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"for (int i = 0; i < end; i++) {\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Three-part expression loop\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"for i := 0; i < end; i++:\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"for (int i = 0; i < end; i++) {\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Iterate over collection\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"collection.do: |x|\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"for (auto x : collection) {\"))), mdx(\"tr\", null, mdx(\"td\", null, \"While loop\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"while condition:\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"while (condition) {\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Import local from library\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"import .library\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"#include \\\"file\\\"\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Import from library\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"import library\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"#include <file>\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Import into current namespace\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"import library show *\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"#include <file>\", mdx(\"br\", null), \"using namespace file;\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Print/log\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"print \\\"Hello\\\"\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"std::cout << \\\"Hello\\\\n\\\";\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Print with interpolation\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"print \\\"Hello $name\\\"\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"std::cout << \\\"Hello \\\" << name << \\\"\\\\n\\\";\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Interpolate with padding\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"print \\\"Hello $(%9s name)\\\"\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"printf(\\\"Hello %9s\\\\n\\\", name);\"))))), mdx(Tab, {\n    label: \"Toit vs Java\",\n    mdxType: \"Tab\"\n  }, mdx(\"table\", null, mdx(\"tr\", null, mdx(\"th\", null), mdx(\"th\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"Toit\")), mdx(\"th\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"Java\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Current object\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"this\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"this\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Single line comments\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"//\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"//\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Logical 'and', 'or' and 'not' operators\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"and or not\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"&& || !\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Shift left, right, unsigned right\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"<<  >>  >>>\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"<< >> >>>\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Integer division\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"/ (on integer types)\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"/ (on integer type)\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Integer sizes\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"64\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"8/16/32/64\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Statement grouping\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"(indent)\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"{ ... }\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Define a class Foo that inherits from Bar\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"class Foo extends Bar:\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"public class Foo extends Bar {\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Define constructor for class Foo\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"constructor x:\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"public Foo(int x) {\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Define constructor for class Foo that calls constructor of superclass Bar\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"constructor x:\", mdx(\"br\", null), \"\\xA0\\xA0super x\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"public Foo(int x) {\", mdx(\"br\", null), \"\\xA0\\xA0super(x);\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Constructor that assigns to fields\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"constructor .x:\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"Foo(int x) {\", mdx(\"br\", null), \"\\xA0\\xA0this.x = x;\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Check object has type\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"bar is Foo\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"bar instanceof Foo\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Check object does not have type\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"bar is not Foo\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"!(bar instanceof Foo)\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Call a method foo with two arguments\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"foo x y\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"foo(x, y);\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Declare a member variable in a class\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"x := null\", mdx(\"br\", null), \"x := ?\", mdx(\"br\", null), \"x/int := 0\", mdx(\"br\", null), \"x/int := ?\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"int x;\", mdx(\"br\", null), \"int x = 0;\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Declare a local variable in a method\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"x := null\", mdx(\"br\", null), \"x := ?\", mdx(\"br\", null), \"x/int := 0\", mdx(\"br\", null), \"x/int := ?\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"int x;\", mdx(\"br\", null), \"int x = 0;\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Define a constant\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"X ::= 0\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"final int X = 0;  // Local.\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Define a constant in a class\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"static X ::= 0\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"public static final int X = 0;\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Define a top-level function\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"foo x y:\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"Use a static method in a class.\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Define an instance method in a class\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"foo x y:\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"public int foo(int x, int y) {\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Define a static method in a class\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"static foo x y:\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"public static int foo(int x, int y) {\"))), mdx(\"tr\", null, mdx(\"td\", null, \"If statement\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"if condition:\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"if (condition) {\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Fixed loop\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"end.repeat: |i|\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"for (int i = 0; i < end; i++) {\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Three-part expression loop\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"for i := 0; i < end; i++:\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"for (int i = 0; i < end; i++) {\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Iterate over collection\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"collection.do: |x|\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"for (Foo x : collection) {\"))), mdx(\"tr\", null, mdx(\"td\", null, \"While loop\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"while condition:\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"while (condition) {\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Import local from library\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"import .library\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"Use package members or imports.\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Import from library\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"import library\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"import com.example.Library;\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Import into current namespace\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"import library show *\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"import com.example.Class;\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Print/log\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"print \\\"Hello\\\"\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"System.out.println(\\\"Hello\\\");\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Print with interpolation\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"print \\\"Hello $name\\\"\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"System.out.printf(\\\"Hello %s\\\\n\\\", name);\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Interpolate with padding\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"print \\\"Hello $(%9s name)\\\"\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"System.out.printf(\\\"Hello %9s\\\\n\\\", name);\"))))), mdx(Tab, {\n    label: \"Toit vs JavaScript\",\n    mdxType: \"Tab\"\n  }, mdx(\"table\", null, mdx(\"tr\", null, mdx(\"th\", null), mdx(\"th\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"Toit\")), mdx(\"th\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"JavaScript\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Current object\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"this\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"this\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Single line comments\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"//\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"//\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Logical 'and', 'or' and 'not' operators\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"and or not\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"&& || !\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Shift left, right, unsigned right\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"<<  >>  >>>\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"<< >> >>>\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Integer division\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"/ (on integer types)\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"Math.trunc(x / y)\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Integer sizes\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"64\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"Number: exact integers through 2^53 - 1; BigInt: arbitrary precision\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Statement grouping\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"(indent)\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"{ ... }\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Define a class Foo that inherits from Bar\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"class Foo extends Bar:\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"class Foo extends Bar {\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Define constructor for class Foo\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"constructor x:\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"constructor(x) {\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Define constructor for class Foo that calls constructor of superclass Bar\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"constructor x:\", mdx(\"br\", null), \"\\xA0\\xA0super x\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"constructor(x) {\", mdx(\"br\", null), \"\\xA0\\xA0super(x);\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Constructor that assigns to fields\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"constructor .x:\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"constructor(x) {\", mdx(\"br\", null), \"\\xA0\\xA0this.x = x\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Check object has type\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"bar is Foo\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"bar instanceof Foo\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Check object does not have type\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"bar is not Foo\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"!(bar instanceof Foo)\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Call a method foo with two arguments\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"foo x y\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"foo(x, y)\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Declare a member variable in a class\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"x := null\", mdx(\"br\", null), \"x := ?\", mdx(\"br\", null), \"x/int := 0\", mdx(\"br\", null), \"x/int := ?\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"this.x = null\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Declare a local variable in a method\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"x := null\", mdx(\"br\", null), \"x := ?\", mdx(\"br\", null), \"x/int := 0\", mdx(\"br\", null), \"x/int := ?\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"let x = null\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Define a constant\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"X ::= 0\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"const X = 0\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Define a constant in a class\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"static X ::= 0\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"static X = 0;  // Reassignable.\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Define a top-level function\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"foo x y:\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"function foo(x, y) {\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Define an instance method in a class\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"foo x y:\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"foo(x, y) {\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Define a static method in a class\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"static foo x y:\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"static foo(x, y) {\"))), mdx(\"tr\", null, mdx(\"td\", null, \"If statement\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"if condition:\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"if (condition) {\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Fixed loop\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"end.repeat: |i|\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"for (let i = 0; i < end; i++) {\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Three-part expression loop\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"for i := 0; i < end; i++:\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"for (let i = 0; i < end; i++) {\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Iterate over collection\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"collection.do: |x|\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"for (const x of collection) {\"))), mdx(\"tr\", null, mdx(\"td\", null, \"While loop\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"while condition:\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"while (condition) {\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Import local from library\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"import .library\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"import * as library from './library.js';\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Import from library\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"import library\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"import * as library from 'library';\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Import into current namespace\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"import library show *\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"import { foo, bar } from 'library';\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Print/log\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"print \\\"Hello\\\"\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"console.log(\\\"Hello\\\")\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Print with interpolation\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"print \\\"Hello $name\\\"\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"console.log(\\\"Hello \\\" + name)\"))), mdx(\"tr\", null, mdx(\"td\", null, \"Interpolate with padding\"), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"print \\\"Hello $(%9s name)\\\"\")), mdx(\"td\", null, mdx(\"samp\", {\n    style: {\n      whiteSpace: \"pre-wrap\"\n    }\n  }, \"console.log('Hello ' + name.padStart(9));\")))))), mdx(\"p\", null, \"A final Toit binding does not freeze its object. Python constants are a naming\\nconvention; JavaScript class fields are not made final by \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"static\"), \".\"), mdx(\"p\", null, \"C++ type tests above assume a polymorphic base and a pointer. Toit object\\nreferences are managed values, and \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"is\"), \" does not require a pointer cast.\\nC/C++ \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"#include\"), \" is textual inclusion; Toit imports load library declarations.\"), mdx(\"p\", null, \"Python \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"//\"), \" floors the result; Toit integer \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"/\"), \" truncates toward zero. JavaScript\\n\", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"Number\"), \" division is floating point, and its bitwise operators use 32-bit values;\\nToit integers are signed 64-bit values. The tables show the closest common\\nspelling, not a promise that porting the expression preserves every edge case.\"));\n}\n;\nMDXContent.isMDXComponent = true;","tableOfContents":{"items":[{"url":"#language-comparison-cheat-sheet","title":"Language comparison cheat sheet"}]}}},"pageContext":{"title":"Comparison cheat sheet","id":"7e92680f-f2a1-5b69-a6d2-42ae5eb17163"}},
    "staticQueryHashes": ["2197327828"]}