I'm very sorry to bother you on this outdated language, but is there any way to check if the particular array element is empty in pascal? It's an integer array, so checking element against empty string causes type mismatch (I love this language!). Thanks for your time.
Asked
Active
Viewed 3,709 times
2
-
1Can you show some code? Some type declarations, perhaps what you've tried too? – Greg Hewgill Feb 21 '11 at 18:49
-
1By the way, Pascal and its descendents are very much alive and well today; and some of us do love it! – David Heffernan Feb 21 '11 at 18:51
-
@Greg I just didnt know that integer in pascal is never empty =) @David Well, some descendants like Delphi are more than alive, yes. – Arnthor Feb 21 '11 at 19:19
1 Answers
5
An integer value cannot be empty. It always holds a value. It's not like a nullable type in certain modern languages.
Sometimes, by convention, certain values are used as sentinels, but you obviously need to apply this convention consistently across all uses of the variable. What's more, a sentinel is only viable if you have some spare values that do not have a meaning in whatever calculation you are performing.

David Heffernan
- 601,492
- 42
- 1,072
- 1,490