Codeacademy

Message Bookmarked
Bookmark Removed
Not all messages are displayed: show all messages (254 of them)

or firebug

the marijuanaut farmer (am0n), Tuesday, 10 January 2012 16:28 (twelve years ago) link

if it consoles u (punz, lol) iatee, i forgot about the === entirely and originally wrote ( i % 3 is 0 ). imagine my shock when they didn't recognize the 'is' syntax.

Mordy, Tuesday, 10 January 2012 17:21 (twelve years ago) link

Okay, I'm stuck on the "Fizzbuzz". I could code it so that for the iteration of 15 it says FizzBuzz, but I'd prefer to code it so that it would check for any numbers divisible by both 3 and 5 (so, for instance, if I changed the count length it would still work and say FizzBuzz in the right place). But I can't work out how to do it.

emil.y, Tuesday, 10 January 2012 17:47 (twelve years ago) link

I think "and" is && in Javascript if that helps?

The Eyeball Of Hull (Colonel Poo), Tuesday, 10 January 2012 17:49 (twelve years ago) link

SPOILER TAGZ

for ( i % 3 === 0 ) {
for (i % 5 === 0 ) {
console.log ("Fizzbuzz");
}
else {
console.log ("Fizz");
}

^^ I think that's how I did it.

Mordy, Tuesday, 10 January 2012 17:50 (twelve years ago) link

fizzbuzz done!

call all destroyer, Tuesday, 10 January 2012 17:50 (twelve years ago) link

the second for should be an if i think

Mordy, Tuesday, 10 January 2012 17:50 (twelve years ago) link

yeah i did an &&

call all destroyer, Tuesday, 10 January 2012 17:51 (twelve years ago) link

emily, you can nest one if/else inside another if/else. if that helps?

vision creation newgod (c sharp major), Tuesday, 10 January 2012 17:52 (twelve years ago) link

^ that's what i did

Mordy, Tuesday, 10 January 2012 17:52 (twelve years ago) link

Thanks guys. I tried "&" but I don't think any of the lessons had mentioned "&&" before. I was so close!

I think their preferred method was nesting, but the && trick seemed more natural to me?

emil.y, Tuesday, 10 January 2012 17:54 (twelve years ago) link

I'm still stuck on buzz tbh

I keep toying around with } and { everywhere

iatee, Tuesday, 10 January 2012 17:56 (twelve years ago) link

is it supposed to be an if else? two ifs? two fors? couldn't all of those work if I formatted it correctly?

iatee, Tuesday, 10 January 2012 17:59 (twelve years ago) link

"else if" rather than "if else" should do it.

emil.y, Tuesday, 10 January 2012 17:59 (twelve years ago) link

syntactically it's:

if ( )

else if ( )

else if ( )

else ( )

Mordy, Tuesday, 10 January 2012 18:00 (twelve years ago) link

That's the one.

emil.y, Tuesday, 10 January 2012 18:01 (twelve years ago) link

Or, well, that works for FizzBuzz, but if you're still stuck on Buzz you want:

if ()

else if ()

else ()

emil.y, Tuesday, 10 January 2012 18:02 (twelve years ago) link

This is good fun, FizzBuzz was the first one I feel like I've actually solved through thinking rather than just arbitrarily moving { around until it just works (used nested if to fix it)

It hurts my brain a bit that on my screen { and ( are almost indistinguishable, and it took me ages of c+ping before I realised the % is just the percent sign.

useless chamber, Tuesday, 10 January 2012 18:04 (twelve years ago) link

ah got it, it was just one } that was haunting me

iatee, Tuesday, 10 January 2012 18:04 (twelve years ago) link

i hope they keep putting out lessons all year. so far they only have 3 up, and i can't imagine it's a breeze to make a new lesson every week.

Mordy, Tuesday, 10 January 2012 18:07 (twelve years ago) link

from the looks of it it's an actual startup w/ people who work there

iatee, Tuesday, 10 January 2012 18:07 (twelve years ago) link

so I'm guessing they're more concerned about keeping the traffic after week one + making the lessons is the easy part

iatee, Tuesday, 10 January 2012 18:08 (twelve years ago) link

it can be hard to see but if you click next to a { or } it will highlight its mate (and i think highlight red if it doesn't have one).

call all destroyer, Tuesday, 10 January 2012 18:16 (twelve years ago) link

oh that's nifty

iatee, Tuesday, 10 January 2012 18:18 (twelve years ago) link

oh that's nifty

iatee, Tuesday, 10 January 2012 18:18 (twelve years ago) link

really interesting to see that theyre using triple equals so early on.. i code for a living and i'm still not completely clear on the difference between == and === in javascript

pat methamphetamine (diamonddave85), Tuesday, 10 January 2012 18:30 (twelve years ago) link

yah they just said == can occasionally cause problems?

call all destroyer, Tuesday, 10 January 2012 18:35 (twelve years ago) link

I think that's a deliberate policy to get people in the habit of using === unless they're absolutely sure they want ==, which can cause some hard-to-find bugs

a lot of JS tutorials seem to be doing that now (I last used JS in like 2003 but decided to brush up on the basics a bit last year to do some HTML5 Canvas stuff)

quite tempted to try this tonight instead of doing some homework which is due tomorrow

(I also code for a living but my skills are very out of date and I'm stuck in an obscure (not difficult, just not resulting in any transferrable skills) rut at work. I can either be scared of this when in 5 weeks' time there are 250,000 new people who know just as much as I've been getting by on in paid jobs for a decade - and yes, I do think that's possible - or I can at least look at it myself...)

Schleimpilz im Labyrinth (a passing spacecadet), Tuesday, 10 January 2012 18:56 (twelve years ago) link

it's pretty good, I really like the site and its mission. Granted, I already know basic programming, but I'm curious to see how far this goes.

Nhex, Friday, 13 January 2012 00:06 (twelve years ago) link

ok, I've never heard of === before, is it just a Javascript thing?

*Checks Wikipedia*

Aha, I see: The languages JavaScript and PHP extends this syntax, with the "==" operator able to return true if two values are equal, even if they have different types (for example, "4 == "4"" is true), and the "===" operator returning true only if two values are equal and have equivalent types as well (such that "4 === "4"" is false but "4 === 4" is true).

questino (seandalai), Friday, 13 January 2012 00:32 (twelve years ago) link

huh, i thought == checked for type as well

Nhex, Friday, 13 January 2012 03:41 (twelve years ago) link

i couldn't figure out the && thing, so i just used i % 15 = 0. kinda felt like i was cheating.

i will admit to feeling legitimately proud of myself when i was able to make fizzbuzz work for a variable that you enter. looking forward to the next lesson...

and you are a part of everything and everything is like melting (ytth), Saturday, 14 January 2012 06:21 (twelve years ago) link

well the prob is you haven't covered 45 and 60 and 90 and stuff!

just make a separate if statement that looks like

if ( i % 3 === 0 && i & 5 === 0)

put it before the fizz and buzz statements, and make them else if statements. i think that's how i did it. i rewrote it to use nesting later.

call all destroyer, Saturday, 14 January 2012 14:52 (twelve years ago) link

oops that last & should be a %

call all destroyer, Saturday, 14 January 2012 14:52 (twelve years ago) link

oops that last & should be a %

call all destroyer, Saturday, 14 January 2012 14:52 (twelve years ago) link

Wait, is the thing of not covering 45 etc directed at ytth? Because those numbers are divisible by 15, so they should come up as FizzBuzz.

Has everyone else had a go at the Java courses? Haven't had time to look at those.

emil.y, Saturday, 14 January 2012 17:44 (twelve years ago) link

i went back and played around with it after reading the thread and was able to make it work with the &&. but yeah, emil.y is right - if it's divisible by 3 and 5, then it will be divisible by 15, so the program told me i had done it right - i just felt like there was a more elegant way.

i did the 'functions in javascript' course, but i didn't like it - it seemed like a refresher that would be good for someone that was already familiar with this, but just needed some tips on how to avoid bugs in their code.

and you are a part of everything and everything is like melting (ytth), Saturday, 14 January 2012 18:01 (twelve years ago) link

oh yeah; i suck at math

call all destroyer, Saturday, 14 January 2012 20:00 (twelve years ago) link

doing this from scratch - i learned a little C++ about ten years ago and lol HTMl at around the same time but i'm half considering taking courses so hopefully this gives me half an idea what i'm in for

til the power failure (darraghmac), Sunday, 15 January 2012 18:26 (twelve years ago) link

Had a rough week but was able to finish the first lessons this morning. It was okay; I haven't done much beyond basic html before (unless you count basic and logo back in grade school), and this made some sense. Felt more like I was parroting than learning, but it was only week 1.

EZ Snappin, Monday, 16 January 2012 14:22 (twelve years ago) link

yeah, tbh i felt like i was filling in blanks but couldn't write the same code from scratch or anything- i may go over the first lessons again.

modric conservative (darraghmac), Monday, 16 January 2012 14:31 (twelve years ago) link

finished for this week!

Mordy, Wednesday, 18 January 2012 04:17 (twelve years ago) link

it's def getting harder

Mordy, Wednesday, 18 January 2012 04:17 (twelve years ago) link

If I want to recommend this to people how exactly do I do it? Like, just point them to the courses page, or is there a separate week-by-week thing?

Gravel Puzzleworth, Sunday, 22 January 2012 13:52 (twelve years ago) link

Wait wait nevermind it's codeyear not codeacademy! Got it.

Gravel Puzzleworth, Sunday, 22 January 2012 13:57 (twelve years ago) link

Did first half today. Dice game this week?

Mordy, Wednesday, 25 January 2012 04:34 (twelve years ago) link

i am finding bits of this insanely confusing - in lesson 5 of "functions in javascript" there's this bit where you're supposed to look at the code and predict the answer and though i knew the likely answer i just couldn't work out what the code was doing to get it

i.e. how does

var result = 1;
for (var i = 0; i < exponent; i++) {
result = result * base; }
return result ;

even work?

like: if you have defined result as 1, what enables it to recognise that 'result' is capable of being a number that is not 1?
would it break if you changed the fourth line of the above to

result * base = result;
? and would that be because you're departing from conventional order or because that order screws the maths up?

what a difference delay makes (c sharp major), Wednesday, 25 January 2012 12:34 (twelve years ago) link

result is a variable (hence "var") which means its value can change.

it would break if you changed the fourth line, not because of maths but because of the syntax of assigning a value - you can't assign a value to an expression like that.

The Eyeball Of Hull (Colonel Poo), Wednesday, 25 January 2012 12:49 (twelve years ago) link

i.e. the interpreter will read the line left to right, syntax being variable = expression, not the other way round.

The Eyeball Of Hull (Colonel Poo), Wednesday, 25 January 2012 12:49 (twelve years ago) link

ok, that does help.

another reason the above flummoxed me utterly: it took me forever to remember what 'i' was (i kept thinking 'integer', which is not useful).

what a difference delay makes (c sharp major), Wednesday, 25 January 2012 12:55 (twelve years ago) link

oh but regardless if he has a show coming up let me know, it would be nice to meet you and to see his stuff in person

Karl Malone, Saturday, 21 February 2015 18:32 (nine years ago) link

i cld just introduce u on facebook or w/e, i wldnt worry abt not having the right skills hes super nice and humble and im sure wld be happy to talk shop, tho u wld have to refriend me lmao

lag∞n, Saturday, 21 February 2015 18:33 (nine years ago) link

smdh at myself

Karl Malone, Saturday, 21 February 2015 18:50 (nine years ago) link

ha i do actually remember thinking to myself i have already been obnoxious once toward zach today maybe i shdnt go in a second time but then i did

lag∞n, Saturday, 21 February 2015 18:53 (nine years ago) link

anyway dont worry ilx we r friends again

lag∞n, Saturday, 21 February 2015 18:53 (nine years ago) link

<3

for real let me know if you attend one of his shows anytime soon. i'm reading/watching this and like his stuff a lot so far.

Karl Malone, Saturday, 21 February 2015 18:55 (nine years ago) link

cool will do, tbh i havent seen him in a few years but thats mostly a function of not being in new york and were not like super tight but id be cool to see his show and say hi

lag∞n, Saturday, 21 February 2015 18:57 (nine years ago) link

tho i might be totally imagining that he said he had a show coming up, but maybe we cld visit his studio or something

lag∞n, Saturday, 21 February 2015 18:58 (nine years ago) link

oh no wait here we go https://instagram.com/p/zOGmAbL3CT

lag∞n, Saturday, 21 February 2015 18:59 (nine years ago) link

cool, yeah i'd be up for going to the show for sure

Karl Malone, Saturday, 21 February 2015 19:10 (nine years ago) link

cool man its on

lag∞n, Saturday, 21 February 2015 19:11 (nine years ago) link

four months pass...

i've been doing the web design courses w/ this - they're fun!

Mordy, Wednesday, 15 July 2015 13:42 (eight years ago) link


You must be logged in to post. Please either login here, or if you are not registered, you may register here.