Re: case and foreach

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

I too have yearned for the "case", "foreach", and "next" statements. However,
one of Euphoria's goals is to keep the code simple and these suggestions kinda
run against that trend. Regardless, I've found myself wishing I had a "next"
statementmany times when I need to find all possible permutations of a certain
string. Also, if you look at probably 90% of for loops, they seem to be used in
instances where "foreach" would be much better.

"Case" I'm torn on. While yes "select" and "case" would be excellent things to
add you don't really need them. Yes, they'd increase productivity and probably
make it easier to debug but they aren't necessary, "if" and "then" work perfectly
fine (even if it takes longer to type all the conditions in).

"Next" we can live without but most people seem to want "foreach" and
"select/case".

Here's my suggestion for the syntax:

-- select/case
select x do
  case 5 then
    -- code
  end case
  case 2 then
    --code
  end case
end select

-- foreach
foreach o in s by 1 do -- o is an object
  -- code
end foreach

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

Search



Quick Links

User menu

Not signed in.

Misc Menu