if .... else case
-
if (FileType = 0) then
FileSaveAs(Sender)
else begin
case FileType of
1:SaveCDL(FileName,List);
2:SaveDXF(FileName,List);
3:SaveFile(FileName,List);
end; {case FileType}
end; {if (FileType = 0) else ...}I came across this in some code (written by someone else) that I am looking through to find the cause of a save/load error. :sigh:
The United States invariably does the right thing, after having exhausted every other alternative. -Winston Churchill America is the only country that went from barbarism to decadence without civilization in between. -Oscar Wilde Wow, even the French showed a little more spine than that before they got their sh*t pushed in.[^] -Colin Mullikin
-
if (FileType = 0) then
FileSaveAs(Sender)
else begin
case FileType of
1:SaveCDL(FileName,List);
2:SaveDXF(FileName,List);
3:SaveFile(FileName,List);
end; {case FileType}
end; {if (FileType = 0) else ...}I came across this in some code (written by someone else) that I am looking through to find the cause of a save/load error. :sigh:
The United States invariably does the right thing, after having exhausted every other alternative. -Winston Churchill America is the only country that went from barbarism to decadence without civilization in between. -Oscar Wilde Wow, even the French showed a little more spine than that before they got their sh*t pushed in.[^] -Colin Mullikin
-
if (FileType = 0) then
FileSaveAs(Sender)
else begin
case FileType of
1:SaveCDL(FileName,List);
2:SaveDXF(FileName,List);
3:SaveFile(FileName,List);
end; {case FileType}
end; {if (FileType = 0) else ...}I came across this in some code (written by someone else) that I am looking through to find the cause of a save/load error. :sigh:
The United States invariably does the right thing, after having exhausted every other alternative. -Winston Churchill America is the only country that went from barbarism to decadence without civilization in between. -Oscar Wilde Wow, even the French showed a little more spine than that before they got their sh*t pushed in.[^] -Colin Mullikin
-
no, this is the VB way of comparison
-
no, this is the VB way of comparison
-
It seems to be Pascal, not VB. But, in Pascal = is also a comparison, AFAIR. Frankly, I don't see where the horror is.
Greetings - Jacek
omg yes it's PASCAL ... guess the horror is the fact, that there is no need for the outer IF, because it could be handled inside the CASE as well
-
omg yes it's PASCAL ... guess the horror is the fact, that there is no need for the outer IF, because it could be handled inside the CASE as well
TorstenFrings wrote:
no need for the outer IF, because it could be handled inside the CASE
Yeah, that's it. Having the if instead of just case 0 seems a bit like someone wasn't actually thinking about what they were coding.
The United States invariably does the right thing, after having exhausted every other alternative. -Winston Churchill America is the only country that went from barbarism to decadence without civilization in between. -Oscar Wilde Wow, even the French showed a little more spine than that before they got their sh*t pushed in.[^] -Colin Mullikin
-
It seems to be Pascal, not VB. But, in Pascal = is also a comparison, AFAIR. Frankly, I don't see where the horror is.
Greetings - Jacek
Jacek Gajek wrote:
It seems to be Pascal, not VB.
It's Delphi. So, you were almost right.:thumbsup:
The United States invariably does the right thing, after having exhausted every other alternative. -Winston Churchill America is the only country that went from barbarism to decadence without civilization in between. -Oscar Wilde Wow, even the French showed a little more spine than that before they got their sh*t pushed in.[^] -Colin Mullikin
-
if (FileType = 0) then
FileSaveAs(Sender)
else begin
case FileType of
1:SaveCDL(FileName,List);
2:SaveDXF(FileName,List);
3:SaveFile(FileName,List);
end; {case FileType}
end; {if (FileType = 0) else ...}I came across this in some code (written by someone else) that I am looking through to find the cause of a save/load error. :sigh:
The United States invariably does the right thing, after having exhausted every other alternative. -Winston Churchill America is the only country that went from barbarism to decadence without civilization in between. -Oscar Wilde Wow, even the French showed a little more spine than that before they got their sh*t pushed in.[^] -Colin Mullikin
Oh, shit, Pascal :) Haven't seen it for several years. Is Delphi still alive? Anyway wouldn't it be easier to write something like
case FileType of
0:FileSaveAs(Sender);
1:SaveCDL(FileName,List);
2:SaveDXF(FileName,List);
3:SaveFile(FileName,List);
end;Or religion doesn't allow? Sorry for possible syntax mistakes. But like I said: I haven't seen it for several years.
-
Jacek Gajek wrote:
It seems to be Pascal, not VB.
It's Delphi. So, you were almost right.:thumbsup:
The United States invariably does the right thing, after having exhausted every other alternative. -Winston Churchill America is the only country that went from barbarism to decadence without civilization in between. -Oscar Wilde Wow, even the French showed a little more spine than that before they got their sh*t pushed in.[^] -Colin Mullikin
Colin Mullikin wrote:
It's Delphi. So, you were almost right.
He was absolutely right. Delphi is not a programming language, it's IDE just like Visual Studio. Object Pascal is used as a programming language inside. I know what I'm talking about. I had the pleasure of working with Delphi/C++ Builder. It was more than 5 years ago though. I still remember C++ Builder 6. But Borland is dead now:( .
-
Oh, shit, Pascal :) Haven't seen it for several years. Is Delphi still alive? Anyway wouldn't it be easier to write something like
case FileType of
0:FileSaveAs(Sender);
1:SaveCDL(FileName,List);
2:SaveDXF(FileName,List);
3:SaveFile(FileName,List);
end;Or religion doesn't allow? Sorry for possible syntax mistakes. But like I said: I haven't seen it for several years.
Yep, you hit the nail on the head with that one. I have no clue why the original programmer didn't do that in the first place. I changed it to that, since it looks much cleaner.
The United States invariably does the right thing, after having exhausted every other alternative. -Winston Churchill America is the only country that went from barbarism to decadence without civilization in between. -Oscar Wilde Wow, even the French showed a little more spine than that before they got their sh*t pushed in.[^] -Colin Mullikin