Skip to content

Instantly share code, notes, and snippets.

@adamcameron
Created July 25, 2012 18:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adamcameron/3177555 to your computer and use it in GitHub Desktop.
Save adamcameron/3177555 to your computer and use it in GitHub Desktop.
Example of using finally incorrectly: 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, "=");
}
}
}
catch (any e){
rethrow;
}
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