- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
I would much rather see something like
(with sensible naming, given the context of the solution)
than a verbose string of if-elsif-else's. Why? Because they are far more likely to fit on a single screen. Because it is trivial to add another case by simply adding another row. In other words, this construct maps cases to actions, and the implementation makes that clear. I don't care that the compiler will turn both into the same code. This is easier make sense of, even if it is not as "easy to read".
Funny symbols are not the enemy. You can pretty much ignore them -- context makes their semantics transparent. Unnecessary explicit sequencing is the enemy.
Admin
It may mean comparison, where you filter from all possible values from x^n those where it n equals a number from 0 to ∞, adding those values up. I’ve heard mathematicians do not think unlike Haskell programmers.
Admin
Also, no need for a separate list of images yet, but i suppose having many (more) buttons and many images might warrant it, but it still would be something like "for x:=1 to N do Image[x].Visible := t = x;".
PS Your array syntax is fine, your boolean isn't. :p
Admin
Pascal was perfect in every way except that it was nearly unusable. C++ was horrible, but it was usable.
Admin
You must be new here. I became convinced long ago that typos and grammar errors must be intentionally inserted, because there isn't a single article without them.
Admin
If you cannot wrap your little twisted head around a simple concept such as the Ternari operator, please stop calling yourselves a programmer (never mind a software engineer).
Thanks for playing.
Admin
Needless to say it could be boiled down to one simple loop, as you can easily iterate through the form fields and set the flags, something like:
for i := 1 to MainForm.FieldCount do with Form.Fields[ i ] do if Name = 'Button' + I2S( i ) then Visible := t = i;