(imported topic written by jonesy91)
Anyone reading the subject will know I’m not just new to the BF language, but coding as a whole, so please bear with me.
I’ve just started going through the documentation and while basic comprehension is there (I think), such as with simpler syntaxes, I see enough differences in how parentheses are used where fully understanding when and how I should use them is escaping me.
Generally speaking, it seems parentheses should be used to encapsulate an entire clause of what asking BF to do. For instance (from pg. 17 of the relevance language reference):
(files of folders “c:”) whose (name of it contains “a”)
Returns all files with an “a” in the name that exist on the C: drive.
But this:
files of folder “c:” whose (name of it contains “a”)
Will return “nonexistent object”, because it seems the “it” keyword is now looking for folders, not files. Not only that, but "files of folder “c:” can be viewed as one distinct clause related to each other, so not including them in parentheses is screwing things up.
Finally, because it is not in parentheses, the syntax is looking for the closest reference of an object, which in the second example is folder.
Maybe I’m correct in this or maybe not, but this is about the simplest representation of using parentheses. Getting into more heavy-duty stuff is another matter.
While practice and experience will solve a lot of the comprehension problems, I’m wondering if there’s any documentation, tips and so on, that might help. Using parentheses is clearly one of the building blocks of the language, so understanding them might help to unlock other things.
Thanks for any help!