Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Example of using finally correctly: http://bit.ly/O9EXTS
function findEntry(filePath, entry) {
var file = "";
var line = "";
try {
file = fileOpen(filePath, "read", "UTF-8");
line = "";
while (!fileIsEOF(file)) {
line = fileReadLine(file);
if (listFirst(line, "=") == entry){
// found it
return listRest(line, "=");
}
}
}
finally {
fileClose(file);
}
// didn't find it
return "";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment