FiM++ Wiki
Register
Advertisement

A switch statement is FiM++'s way of compressing code for the programmer and making if-then-elseif-then chains more readable by the reader.

Related Phrases[]

  • In regards to
  • On the
    • hoof
    • nd hoof
    • rd hoof
    • st hoof
    • th hoof
  • If all else fails
  • That's what I did

FDS[]

  • Case:
    On the <value:number constant>[nd hoof/rd hoof/st hoof/th hoof]<punctuation>
    • Optional
    • Selected when the value passed to the declaration is the same as the value in the case.
    • The numerical value MUST be a literal number or constant. Variables and method returns are not allowed.
      • The value must be unique from all others in the switch
    • Can be followed by any runnable code.
  • Default case:
    If all else fails<punctuation>
    • Up to one
    • Selected when no other case is selected
    • Can be followed by any runnable code.

Examples[]

  • In regards to Pinkie’s Tail:
    On the 1st hoof...
    I said “That’s impossible!”.
    On the 2nd hoof...
    I said “There must be a scientific explanation”.
    On the 3rd hoof...
    I said “There must be an explanation”.
    On the 4th hoof...
    I said “Why does this happen?!”.
    I would flail.
    If all else fails...
    I said “She’s just being Pinkie Pie.”.
    That’s what I did.
  • In regards to being silly: That's what I did.
    • A switch does not need a body. This line would only be written for human-readability and should not be compiled.
  • Did you know that the best Princess is number 1?
    Did you know that Luna always is number 1?
    Did you know that Celestia always is number 2?
    In regards to the best Princess:
    On the Luna hoof...
    I said “That’s right!”.
    On the Celestia hoof...
    I said “Something's wrong, here...”.
    That's what I did.

See Also[]

  • Conditional Statements
  • If
  • Else


Advertisement