How To Make An If Else Ladder
Print Hello World
Write Basic Syntax
Use Properties
Make An If Else Ladder
Make A Branch Statement
Declare Inits
Use Lists
Use Arrays
Make A Class Hierarchy
Use Nil And Nilable Types
Use Dynamic Typing
Declare Variable Number Of Args
Read And Write Files
Check Inheritance And Implementation
Customize Object Equality
Pass References To Methods
Translate Pseudo Code To Cobra 1
Translate Pseudo Code To Cobra 2
Implement IEnumerable 1
Implement IEnumerable 2
Iterate Through Recursive Data With Yield
Make A Collection Class
Declare Contracts
Threads
Win Forms
WPF
GTK
Qyoto
Access MySQL
XNA
Open TK
 
"""
MakeAnIfElseLadder.cobra

Consider possible alternatives to an if-else ladder:

    * Make a class hierarchy and send a message to the object.

    * Use the `branch` statement (see MakeABranchStatement.cobra)

When using an if-else ladder, consider throwing a FallThroughException() at the
bottom if you expect that it should never happen.


See also: MakeABranchStatement.cobra, CheckInheritanceAndImplementation.cobra.
"""


class Program

    def main
        t = Thing()
        if t.isSmall
            print 'small'
        else if t.isMedium
            print 'medium'
        else if t.isLarge
            print 'large'
        else
            throw FallThroughException(t)
            # ^ As seen here, you can (optionally) include a value with the
            # fall-through exception which is the value that was being examined.


class Thing
    """
    A thing is always small, medium or large, and never more than one.
    """

    get isSmall as bool
        return false

    get isMedium as bool
        return true

    get isLarge as bool
        return false