Cheddar Documentation
  • Introduction
  • Syntax
  • Literals
    • Comment
    • String
    • Number
    • Array
    • Boolean
  • Mathematics
    • Addition
    • Subtraction
    • Multiplication
    • Division
    • Exponentiation
    • Remainder
    • Negation
    • Sign
    • Root
    • Bitwise AND
    • Bitwise OR
    • Bitwise XOR
    • Bitwise NOT
    • Bitwise Left Shift
    • Bitwise Right Shift
  • Variables
  • Functions
    • Defining
      • Lambda
      • Functionized Operators
      • Functionized Properties
    • Operations
      • Functional Bonding
      • Functional Composition
  • Default Operators
    • What Is
    • Instance-of
    • Actually Is
  • Control Flow
    • Conditional
    • Loops
      • For Loops
      • While Loops
  • Standard Library
    • String
      • Bytes
      • Count
      • Length
      • Match
      • Slice
      • Tail
      • Chars
      • Head
      • Lines
      • Ord
      • Split
      • Test
      • Chunk
      • Index
      • Lower
      • Reverse
      • Substitute
      • Upper
  • Developing
    • Structure
    • Primitive Objects
      • Scope
      • Class
      • Variable
      • Namespace
    • Getting Started
    • API
      • Primitives
        • string
        • number
        • array
        • bool
        • func
        • nil
Powered by GitBook
On this page

Was this helpful?

Control Flow

In order to perform any sort of logic, control flow statements must exist to form a decision model. Cheddar is abundant with control flow statements, inheriting syntax and statements, from the C language.

Note::Best Practice

In Cheddar, parenthesis are optional around most statements. This is to suit a wider variety of programmings styles. For this reason, when using more complex statements, it is generally regarded as better practice to put parenthesis around your condition

For example the following is readable:

if input is String {
    print "Input is a string!"
}

While the following isn't:

if len input = argv[0].split(",", true).map(-> (i) i - 1) > 3 {
    print "Too many arguments"
}

Without syntax highlighting, this can be quite unreadable at a glance

PreviousActually IsNextConditional

Last updated 4 years ago

Was this helpful?