×

Langue

Fermer
Atelier 801
  • Forums
  • Dev Tracker
  • Connexion
    • English Français
      Português do Brasil Español
      Türkçe Polski
      Magyar Română
      العربية Skandinavisk
      Nederlands Deutsch
      Bahasa Indonesia Русский
      中文 Filipino
      Lietuvių kalba 日本語
      Suomi עברית
      Italiano Česky
      Hrvatski Slovensky
      Български Latviešu
      Estonian
  • Langue
  • Forums
  • /
  • Atelier 801
  • /
  • Hors-sujet
  • /
  • Programming
« ‹ 3 / 9 › »
Programming
Todorovski
« Citoyen »
1359831780000
    • Todorovski#0000
    • Profil
    • Derniers messages
    • Tribu
#41
  0
Methusalah a dit :
o that command is really printing?
btw why "i+1" instead of "i++"

I usually do the same, or sometimes "i+ = 5" for example. It saves my time, and it isn't that weird. :p
Fxie
« Citoyen »
1359831780000
    • Fxie#0000
    • Profil
    • Derniers messages
    • Tribu
#42
  0
Cptp a dit :
JS implicitly inserts semicolons if you don't use them. JS doesn't always get it right, and it can lead to obscure and hard to find bugs. May as well write it properly the first time.

This has never, EVER happened to me nor anyone I know. Nor have I ever heard of it happening period.
Cptp
« Citoyen »
1359831900000
    • Cptp#0095
    • Profil
    • Derniers messages
    • Tribu
#43
  0
"Hasn't happened to me so I can continue writing sloppy code"
Fxie
« Citoyen »
1359831900000
    • Fxie#0000
    • Profil
    • Derniers messages
    • Tribu
#44
  0
>it's sloppy because it differs from your personal practices

ok

also, last I checked, adding pure useless junk that doesn't help reading but only adds clutter is sloppy, not cleaning it out.
Todorovski
« Citoyen »
1359832140000
    • Todorovski#0000
    • Profil
    • Derniers messages
    • Tribu
#45
  0
Before a while, I made a javascript program (I don't know how correct it is :o), but still it works good. I don't usually javascript by the way.
http://www.khanacademy.org/cs/paint/1338284994
Sharpiepoops
« Citoyen »
1359833040000
    • Sharpiepoops#0020
    • Profil
    • Derniers messages
    • Tribu
#46
  0
My other car is a cdr!
Cptp
« Citoyen »
1359833340000
    • Cptp#0095
    • Profil
    • Derniers messages
    • Tribu
#47
  0
Fxie a dit :
>it's sloppy because it differs from your personal practices

ok

also, last I checked, adding pure useless junk that doesn't help reading but only adds clutter is sloppy, not cleaning it out.

It's sloppy because it differs from professional practice. For example, http://google-styleguide.googlecode.com/svn/trunk/javascriptguide.xml
Fxie
« Citoyen »
1359833460000
    • Fxie#0000
    • Profil
    • Derniers messages
    • Tribu
#48
  0
You mean preferential practice. If it was a legitimate standard, it would be required. It is not. And please explain why would you add something unnecessary to begin with? What purpose does it serve? Would you add "123" to the end of every line of code simply because someone tells you even though it doesn't affect your code at all (assuming it didn't)?

p.s. http://mislav.uniqpath.com/2010/05/semicolons/

javascript isn't python, consider that please
Icewolfbob
« Citoyen »
1359836760000
    • Icewolfbob#0095
    • Profil
    • Derniers messages
    • Tribu
#49
  0
In every piece of javascript code I have ever read, semicolons are present. Should you ever work with a team on a project, it may cause an issue if you insist on not putting semicolons since a lot of people do use them. Plus, using them avoids any possible ambiguity. It will be beneficial in the long run too, since a lot of other languages do require them.

I guess it could be considered personal preference; I'd rather stick to using them like most others do.

Oh, that link you edited in shows a nice example of where not using a semicolon can mess things up a little too.
Mousechris
« Censeur »
1359836880000
    • Mousechris#0000
    • Profil
    • Derniers messages
    • Tribu
#50
  0
Isn't programming pretty much the same thing in a TFM map XML code?
Tfmasian
« Citoyen »
1359837300000
    • Tfmasian#0000
    • Profil
    • Derniers messages
    • Tribu
#51
  0
Mousechris a dit :
Isn't programming pretty much the same thing in a TFM map XML code?

^
Baasbase
« Citoyen »
1359837660000
    • Baasbase#0095
    • Profil
    • Derniers messages
#52
  0
I'm afraid you have no clue what programming is chris :')
Xdinochix
« Citoyen »
1359837780000
    • Xdinochix#0000
    • Profil
    • Derniers messages
    • Tribu
#53
  0
what baas said
ive been using scratch for a while now, i know the basics and stuff, once i get into it more ill upload some stuff ive made
Fxie
« Citoyen »
1359838200000
    • Fxie#0000
    • Profil
    • Derniers messages
    • Tribu
#54
  0
Icewolfbob a dit :
In every piece of javascript code I have ever read, semicolons are present. Should you ever work with a team on a project, it may cause an issue if you insist on not putting semicolons since a lot of people do use them. Plus, using them avoids any possible ambiguity. It will be beneficial in the long run too, since a lot of other languages do require them.

I guess it could be considered personal preference; I'd rather stick to using them like most others do.

Oh, that link you edited in shows a nice example of where not using a semicolon can mess things up a little too.

It's an extremely uncommon case that has honestly never happened to me nor anyone I know because, really, what? (a+b).print() is not even possible in JavaScript unless you definte "print" as a prototype of the String object, because you can only add numbers and strings and you can only "print" (in this context) strings.

So, technically, that example isn't even correct. It appears to be possible to create a problem by starting a line off with parenthesis which I hadn't considered nor known about, but seriously, when would you?

I think this minor problem would be fixed if the parser just assumed you wouldn't either, because really nobody separates a function name and the arguments.

dostuff
(arguments) {
//why
}


Good to see you actually looked at the article, though. As for people who do or don't use semicolons: every JavaScript programmer I know doesn't. Not other languages, mind you, because a lot of people who talk about semicolons in JS come from languages that aren't parsed like JS. I mean strictly JavaScript coders who mostly agree semicolons are just pointless and so why bother.
Todorovski
« Citoyen »
1359838320000
    • Todorovski#0000
    • Profil
    • Derniers messages
    • Tribu
#55
  0
Xdinochix a dit :
what baas said
ive been using scratch for a while now, i know the basics and stuff, once i get into it more ill upload some stuff ive made

I was using Scratch for a while, and I liked it. But it stops you being creative and stuff like that. The language is very simple too. Try learning Javascript. :B

Mousechris a dit :
Isn't programming pretty much the same thing in a TFM map XML code?

Lol ofcourse it isn't. xD

Also

http://i.imgur.com/2BdU2Fv.png
Can anyone help me with this, so it doesn't mess up when I try to host it? :x
Fxie
« Citoyen »
1359838440000
    • Fxie#0000
    • Profil
    • Derniers messages
    • Tribu
#56
  0
"stroke" is not a top-level function
you need to get the context of your canvas

so

context=canvas.getContext('2d')

then

context.stroke()

also you can only stroke a path, there are no arguments.

also, background and strokeWeight aren't functions period. I don't know what library you got that from, but it isn't standard. strokeWeight, in real javascript, would be context.lineWidth=number
Todorovski
« Citoyen »
1359838680000
    • Todorovski#0000
    • Profil
    • Derniers messages
    • Tribu
#57
  0
Fxie a dit :
also, background and strokeWeight aren't functions period. I don't know what library you got that from, but it isn't standard. strokeWeight, in real javascript, would be context.lineWidth=number

I've used the khanacademy.org/cs library, and it had very simple codes which were in Javascript I guess. And also I've tried using some other codes from Javascript which didn't work... I guess the website is wrong. :x
Fxie
« Citoyen »
1359838800000
    • Fxie#0000
    • Profil
    • Derniers messages
    • Tribu
#58
  0
Libraries aren't necessarily "wrong," but you need to use the library to use the code. If you want to run the code, the library has to be loaded in the same page. Just get the url of the library and include <script src="url.js"></script> in the html.
Icewolfbob
« Citoyen »
1359839100000
    • Icewolfbob#0095
    • Profil
    • Derniers messages
    • Tribu
#59
  0
Fxie a dit :
As for people who do or don't use semicolons: every JavaScript programmer I know doesn't. Not other languages, mind you, because a lot of people who talk about semicolons in JS come from languages that aren't parsed like JS. I mean strictly JavaScript coders who mostly agree semicolons are just pointless and so why bother.

Yeh, that's true. All the languages I learnt before using javascript required semicolons. If you write only javascript, I understand why you don't see the need to use them. Although, I think using them anyway is easier, because then you get into the habit of using them which will probably save time when you move onto other languages (should you decide to).
Fxie
« Citoyen »
1359839340000
    • Fxie#0000
    • Profil
    • Derniers messages
    • Tribu
#60
  0
I understand the idea: semicolons end a statement. However, to use them in JavaScript is essentially not only adding more to the code which isn't needed but also, for someone not accustomed to using them, a challenge to place them only where actually necessary and not just at the end of every line. I'd honestly find it harder than easier to go through adding them.

I also don't really plan to learn any other languages. I'm actually writing my entire server-side AND database in JavaScript using Node.js and MongoDB. I have experience with PHP, though, and I understood semicolons in PHP well enough while still writing JavaScript the same then.
  • Forums
  • /
  • Atelier 801
  • /
  • Hors-sujet
  • /
  • Programming
« ‹ 3 / 9 › »
© Atelier801 2018

Equipe Conditions Générales d'Utilisation Politique de Confidentialité Contact

Version 1.27