Q7

switch command for ECL

Details

  • Type: Improvement Improvement
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.3.11
  • Fix Version/s: 1.3.13
  • Component/s: ECL
  • Labels:
    None
  • Test Mode:
    Q7

Description

Similar to proc/let/val, the switch/case can be emulated by using extra "case" command, like this:

switch $foo
  [case 52 { 
        // do something
     }]
  [case "whatever" {
        // do something else
     }]
  -default {
     // optional default block
  }

Activity

Hide
vasily.loginov added a comment - 18/Jun/14 4:36 PM - edited

Adding a switch-case command with the following properties:

  • both switch and case commands will be located in the ecl.ecore model, similar to the if command.
  • case works similarly to the val: it returns the Case command itself, which is later executed by the switch command. The switch command checks condition and executes only one case with matching condition.
  • if no case blocks matched, default block will be executed.
Show
vasily.loginov added a comment - 18/Jun/14 4:36 PM - edited Adding a switch-case command with the following properties:
  • both switch and case commands will be located in the ecl.ecore model, similar to the if command.
  • case works similarly to the val: it returns the Case command itself, which is later executed by the switch command. The switch command checks condition and executes only one case with matching condition.
  • if no case blocks matched, default block will be executed.
Hide
vasily.loginov added a comment - 19/Jun/14 3:39 PM

Ready for merge, in "feature/add-switch-case-command"

Show
vasily.loginov added a comment - 19/Jun/14 3:39 PM Ready for merge, in "feature/add-switch-case-command"

People

Vote (0)
Watch (0)

Dates

  • Created:
    14/Jun/14 3:08 PM
    Updated:
    04/Jul/14 8:07 PM
    Resolved:
    04/Jul/14 8:07 PM