1 hour ago · Tech · 0 comments

Dang, I am freakin' productive today. I went to the gym, I went to pick up some odds and ends I needed for groceries... I took a photo of this: What hath God wrought. (Although, tbh, I did buy these: So I really should not be throwing stones.) Okay, no, I am no longer going to make fun of some food items. I'm going to get back into loops. JavaScript While LoopsI like while. It is a good thing to know. I can do things like this: let text = ""; let i = 10; while (i >= 0) { text += "T minus " + i + "<br>"; i--; } do while is also cool, and I kinda get why you would have it, because it executes the code even before you test it. So you can have, like: let text = "" let i = 0; do { text += "<br>The number is " + i; i++; } while (i < 1); Which means you'll always get The number is 0, because it goes through the code and then goes "Oh, wait, i is 1 now, so much for that. " They then point out that while is a lot like a for loop if you don't have the first or the third statement included. So…

No comments yet. Log in to reply on the Fediverse. Comments will appear here.