Code formatting question

Thanks for the post. Over the years I have ended up changing my formatting many times and I fear it might never end. I keep running into reasons to not like the old method or finding a fancy new method. Time will tell if I finely settle but I expect not.

My current code is looking for a balance of functionality and readability. Below is a sample of how I would format. The lower case variables is a new method that I have just started to adopt to help distinguish them from fields and functions.

Let([ 
	coCategory	= Assets::Category 
;	compSoft	= "Software¶Workstations¶Un-Used Computers¶Servers"
;	offEquip	= "Camera¶Printers¶Hardware¶Monitors"
;	furn		= "Furniture"

;	cityCategory = Case	(
				        not IsEmpty ( FilterValues ( compSoft ; coCategory ) ); 
					         "Computer & Software" ; 
				        not IsEmpty ( FilterValues ( offEquip ; coCategory ) ) ; 
					         "Office Equipment";
				       not IsEmpty ( FilterValues ( furn ; coCategory ) ) ; 
					        "Furniture, Fixtures & Leaseholds"; 
				       "Error: Missing Category"
				        )
	]; 
	cityCategory  
)

I like the ; in front of the let variables for easy copy paste like other have said above and for me it is easier to read but I make sure the ; are on the first line. If you put them closer to the code I find that also hard to read. I do not put the ; in front with case statements as this dose not help with copy paste.

Thanks all for the great replies and examples!

I've found the tilde's extremely helpful as a FileMaker beginner to help distinguish the different types of variables and to separate them from functions and tables/fields when reading code. One of the reasons I've started doing it. To be fair though, I don't use tilde anymore out of laziness and just use (`) instead. Debates are being had in the office...

Lower camel case is interesting, but i can imagine needing stricter naming conventions for tables and fields as well.

The semi colons are something new to me as of this job and I'm still getting used to them. I currently use them to make it easier to follow indentation lines for functions, which, I know, breaks the benefits of copy/pasting. I find this helpful for readability in more nested code

1 Like

Absolutely!!

Scope: The tilde (~) or cent (Âą) is not accessible outside of the calculation.
Just as the single $ scope is within the current script vs $$ which is accessible anyplace FOR THAT USER AND THE CURRENT SESSION.