Cyandie Posted June 7, 2012 Posted June 7, 2012 okay so whats the difference from such codes like this if (object == 1) then to if object == 1 then ? Current Projects Cyandie's Cops and Robbers( 10% )
Al3grab Posted June 7, 2012 Posted June 7, 2012 there are no deference but the first one is more organised and its more like scripting style. ING : [xXx]~Al3grab
Cyandie Posted June 7, 2012 Author Posted June 7, 2012 Alright thanks this explains it more Current Projects Cyandie's Cops and Robbers( 10% )
Moderators IIYAMA Posted June 7, 2012 Moderators Posted June 7, 2012 and if you write it like this: if object == 2 or (object == 1) then Will it first check 1 and than it will check 2? or still 2 > 1. In math first thing to do > ( ) ? Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
Callum Posted June 7, 2012 Posted June 7, 2012 None, though I use the 2nd style - it makes the code less ugly and doesn't give such a confusing luck (and you save 2 bytes!) This if var then is the same as if ((((((((((var))))) == (((((var2)))))))))) then Retired
myonlake Posted June 7, 2012 Posted June 7, 2012 None, though I use the 2nd style - it makes the code less ugly and doesn't give such a confusing luck (and you save 2 bytes!)This if var then is the same as if ((((((((((var))))) == (((((var2)))))))))) then Exactly, save two bytes is saving! Recycle! If I helped you, please click the like button on the right Thanks!
Cyandie Posted June 7, 2012 Author Posted June 7, 2012 Cheers everyone for putting in your input Current Projects Cyandie's Cops and Robbers( 10% )
Kenix Posted June 7, 2012 Posted June 7, 2012 I always not use this because someone can confusing with this. For example if i write some big condition. IIYAMA, '( )' working only in arithmetic but not in imparity! If you confusing use lua demo. http://www.lua.org/cgi-bin/demo http://vk.com/the_kenix Вопросы задавайте на форуме, не пишите мне в личку. Please don't pm me.
myonlake Posted June 7, 2012 Posted June 7, 2012 I don't use it at all. I only use it when it's needed, which means for example math. We all know when we need brackets in math, no? If I helped you, please click the like button on the right Thanks!
Dev Posted June 7, 2012 Posted June 7, 2012 Erm, '()' take barely 4 bits. ( 1 byte = 8 bits ) "First they ignore you, then they laugh at you, then they fight you, then you win." - Mahatma Gandhi (1869-1948)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now