> There are coding conventions in TW which to the beginner JS  programmer 
may find puzzling. For example in Tobias' example plugin we have a line 
which says "tid = tid"

The actual line is:

*tid = tid || "GettingStarted"*

That's conceptually similar to the less puzzling line:

*tid = tid + 1*

which causes *tid* to be set to its own previous value + 1.

In Tobias's example, the *||* symbol means "or else", and the line causes 
*tid* to be set to either its current value, or else (if *tid* isn't 
currently set to anything) to *"GettingStarted"*. This is a common idiom 
for supplying a default value for a parameter in JavaScript.

Tobias's example doesn't actually need to use the word *var* (which 
introduces a new variable), because *tid* has already been declared (as a 
parameter).

– æ

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.

Reply via email to