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;
if input == 'y' || input = 'Y'
{
writeln ('blah blah');
} else if input = 'n' || input = 'N'
{
writeln ('blah');
} else
{
writeln ('Input invalid!');
}
If you find Pascal easier to read, I would guess you have very special set of eyes.Instead it would be:
if ((input = 'y') or (input = 'Y')) then
writeln ('blah blah')
else if ((input = 'n') or (input = 'N')) then
writeln ('blah')
else
writeln ('Input invalid!');
OR even better case uppercase(input) of
'Y': writeln('blah blah');
'N': writeln('blah');
else
writeln('Input invalid!'); 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!'); if (input in ['Y', 'y']) then
WriteLn('blah blah')
else if (input in ['N', 'n']) then
WriteLn('blah')
else
WriteLn('Input invalid');
And: if (LowerCase(input) = 'y') then
WriteLn('blah blah')
else if (LowerCase(input) = 'n') then
WriteLn('blah')
else
WriteLn('Input invalid');