+ Start a Discussion
Matt FolgerMatt Folger 

Explain the syntax of Apex: ! , $, ", {, (, Etc.

Hi, I'm new to the world of developing and trying to learn all the syntax, have read a few books on the topic and browsed around for the info but can't find a quick reference of these very basic questions.  

I've gotten by largely by modding existing free GitHub and forum provided code.

But I've still got basic questions regarding what some of these symbols mean and when they are used.

For example:  the ! sign.

The $ sign (I think is to call universal components, as I've used it in the $User context).

The " should convey direct text, but I'm not so sure.

The { and the ( are pretty interchangeable to me, but I know that that can't be right.  When would you use one over the other?

Any other advice much appreciated.
Best Answer chosen by Matt Folger
Phillip SouthernPhillip Southern
Matt,

Right on for $ is for global variables: https://www.salesforce.com/us/developer/docs/pages/Content/pages_variables_global.htm

For "  when you are in visualforce that will dictate the value of a parameter.  In apex to dictate text or a string you use single quote.

{ and ! are used in Visualforce for merge fields and calls to variables and action methods.

In Apex { and ( are used like similarly typed program languages to encapsulate functions, methods, etc.

All Answers

Phillip SouthernPhillip Southern
Matt,

Right on for $ is for global variables: https://www.salesforce.com/us/developer/docs/pages/Content/pages_variables_global.htm

For "  when you are in visualforce that will dictate the value of a parameter.  In apex to dictate text or a string you use single quote.

{ and ! are used in Visualforce for merge fields and calls to variables and action methods.

In Apex { and ( are used like similarly typed program languages to encapsulate functions, methods, etc.
This was selected as the best answer
Matt FolgerMatt Folger
Thanks for the primer.