- Home /
JavaScript Syntax and Punctuation Meanings Question
I would like to know what certain syntax's mean that I've run across but don't understand what the do. Examples
hit.rigidbody || hit.rigidbody.isKinematic --- || separating
!hit --- exclamation sign before function
hit : RaycastHit --- : separating
hit == 2 ---double equal signs
&& ---double "and" signs
Is there anyone who can tell me the purpose of each one of these?
Do some Actionscript 3 tutorials, the syntax is very similar to Unityscript.
Answer by DaveA · May 22, 2012 at 07:09 AM
This is basic programming syntax, you might want to read some tutorials on programming in general.
| is 'or' and a single is bit-wise, where || (double) is logical
! is 'not'
: separating is the type. first thing is variable name, thing after : is the type of variable that is
&& means 'and' (logical). a single & is 'bitwise and'
== means 'is equal to' for comparisongs. a single = means 'assign this to'
Now, google 'bitwise' and 'logical' and 'boolean'
I jumped straight into doing Unity tutorials and Tornado Twins tutorials, and understand what java syntax's do, but I do not understand how I should read or interpret them. for example, I knew the variable before the : and after, but I didn't know what the : meant which separated them, as alot of tutorial codes have them and never explained them, I decided to just ask and learn as I go
Those were the only 5 symbols that gave me issues, I appreciate the explainations
Your answer
Follow this Question
Related Questions
Can someone help me fix my Javascript for Flickering Light? 6 Answers
Setting Scroll View Width GUILayout 1 Answer
Countdown code not working 1 Answer
How to not rely on the Visual Interface 0 Answers
Basic moving GameObject!! 1 Answer