Hacker News new | past | comments | ask | show | jobs | submit login

Great example. Your C-Code translated to Pascal would be

  if (input = 'y') or (input = 'Y') then
  begin
    writeln ('blah blah');
  end
  else if (input = 'n') or (input = 'N') then
  begin
    writeln ('blah');
  end
  else
  begin
    writeln ('Input invalid!');
  end;

Now this does not look any different then your code. Except your code does compile but has several errors.

And why should be the double pipe be any better to read than an "or" statement?

Btw: as you won't need the begin and ends it would look like

  if (input = 'y') or (input = 'Y') then
    writeln ('blah blah')
  else 
  if (input = 'n') or (input = 'N') then
    writeln ('blah')
  else
    writeln ('Input invalid!');



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: