Richard Smith 0fec34df03 Tiny doc update: `var` is not an expression. (#812) 4 年 前
..
README.md 93e7a37493 Start updating control flow design (#544) 4 年 前
conditionals.md e05225f90a Fix conditionals link style (#726) 4 年 前
loops.md 8d3d1b1233 Flesh out loops docs a little (#729) 4 年 前
return.md 0fec34df03 Tiny doc update: `var` is not an expression. (#812) 4 年 前

README.md

Control flow

Overview

Blocks of statements are generally executed linearly. However, statements are the primary place where this flow of execution can be controlled.

Carbon's flow control statements are:

  • if and else provides conditional execution of statements.
  • Loops:
    • while executes the loop body for as long as the loop expression returns True.
    • for iterates over an object, such as elements in an array.
    • break exits loops.
    • continue goes to the next iteration of a loop.
  • return ends the flow of execution within a function, returning it to the caller.