Re: Case Construct

new topic     » goto parent     » topic index » view thread      » older message » newer message

I've been thinking about branching syntax...

if (expression) then
    some_code
else
    other_code
end if

if (expr)
  case 1
    some_code
  case 2
    other_code
  else
    more_code
end if

if_any (expr)
  case 1, 25
    some_code
    exit
  case > 10
    other_code
  case < 5
    code_in_addition_to_other_code
  else
    code_if_none_of_the_above
end if

THEN and CASE after the expression distinguishes the two.

if_any allows fall through because sometimes that is useful.

Muliple cases on a single line is also very useful;  Would it be
confusing to have a sequence represent the multiple cases?  Probably
a comma delimited list would be better.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu