E Style
Bill Frantz <[email protected]>
| Newsgroups | gmane.comp.lang.e.general |
|---|---|
| Message-ID | <r314ps-1065i-556456E5A2F34735AD16B269531C3806@Bill-Frantzs-MacBook-Pro.local> |
In trying to write an E program (to actually do something useful
to me), I noted the apparent lack of the C construct:
(bool ? true_value : false_value)
What I have working now is:
def location := ( if (filename =~ `@{x}Cave@{y}`) { 0 }
else if \
(filename =~ `@{x}Frosty@{y}`) { 1 }
else if \
(filename =~ `@{x}TTT@{y}`) { 2 }
else \
{ -1 })
if (location == -1) {throw(`ERROR: Filename "$filename"
yields $location for offset`)}
(The backslashes seem to be needed.)
Is there a cleaner way to code this fragment?
Cheers - Bill
-----------------------------------------------------------------------
Bill Frantz | I like the farmers' market | Periwinkle
(408)356-8506 | because I can get fruits and | 16345
Englewood Ave
www.pwpconsult.com | vegetables without stickers. | Los Gatos,
CA 95032