Today is the Day explainer


#23

Hi @Elliot_Alderson
DrawBoxes takes a string as an argument, which you have correct. However, if a “variable” is placed inside of a string, it’s not considered a variable, but part of the sentence of the string.
If you do drawBox(x), it will draw an orange box like the string it’s assigned to, but drawBox(‘x’) will not see the variable x but will see a string “x” and draw the color that’s default for “x”.
I would argue that’s it’s easier to stick to just strings instead of variable for drawBoxes() because including a space in your string is an easy way to trigger newLine. Then drawBox() can have variables for colors that you plan on drawing frequently.
Hope this helps! Feel free to reply back if still confused or if I’m just vague :grin:
(Also, I like your username)


#24

@mysteryguy3039 Thanks for your reply.
The drawBoxes function itself contains a parenthesis ’ ’
So what should I do?

(And yeah the name sounds as Mr Robot😁)


#25

@Elliot_Alderson
You can just put the first letter of any basic color you would like to draw. Such as, ‘g’ -> green, ‘w’ -> white, ‘o’ -> orange, etc.
If you do ‘ggg’, 3 green boxes are drawn next to each other. If you do ‘gg g’, 2 green boxes will be drawn next to each other and a third will be moved to the next line (under the first green box).
Hope this helps! :smile:


#26

There’s a small error towards the top of this article:

The first line starts with var lastYear which means: create a new variable and call it month.

Should be:

The first line starts with var month which means: create a new variable and call it month.


#27

Hey @Elliot_Alderson,

In addition to what @mysteryguy3039 has said, you can remove the string from inside drawBoxes() by tapping it once (make sure the keyboard doesn’t appear), then the delete key. After that, you can put variables inside drawBoxes() like drawBoxes(x), which — with the declaration x = 'orange' — will print out a orange box, then a red box, then an amber box, etc.

H :slight_smile:


#28

@Jeff_Rosenberg, thanks so much for catching that! Fixed now :slight_smile:


#29

Thanks @mysteryguy3039
Thanks @Grasshopper_Heather
Very helpful you all…


#30

@Grasshopper_Heather @mysteryguy3039
How can I write drawBoxes(xxx)?
The drawBoxes function is taking only one variable at a time.


#31

@Elliot_Alderson — you can add the variables together. Like: drawBoxes(x + x).

H :slight_smile:


#32

@Grasshopper_Heather but once I add x as variable to the function, the cursor goed to next line automatically.


#34

Don’t know what am doing wrong am stuck here

I’ve tried to rearrange but to no avail it keeps telling me to add a line at the end


#35

Hi @Martins_Oluoma,

This should answer your question:

If not, feel free to reply and I’ll try to go more in-depth. :smile:


#36

Hi everyone,

I have a little problem doing the “Today is the day”. I’ve been feeling sure my code was right but it seems I still stuck…I don’t know why.

This is the code I wrote:

var month = ‘August’;
print ('August");
var day = ‘Friday’;
print ('Friday");

Could anyone tell what could be happening?

Thanks!


#37


Can you help out of this?


#38

Hi @Juapa and @Pramod.93733,

Looks like y’all are having similar issues that should be answered by this:

Hope this helps! Feel free to reply if otherwise :grin:


#39

having trouble dont know what im doing wrong


help me out?


#40

Hello dear supporters. How can I resolve this issue?


#41

Hey @OnBud_Odessa and @dietz_andwattson23,

Looks like you’re both hitting against the same issue. This comment from @mysteryguy3039 should help you solve this puzzle.

H :slight_smile:


#42

The last line of code should be:
Print (day)

But whenever I tap the empty space in the bracket, a quotation marks shows up which I can’t remove it:
Print (’’)

So I’m stuck at:
Print (‘day’)

Is it a bug?


#43

Try tapping on a new line in your code (so none of your current code is highlighted). Then tap once on the orange 'day' string so that the whole string including the quotation marks are highlighted – you should see the button keyboard and not the qwerty keyboard. Now that your string is selected, you can either press the day identifier key, or the delete key and then the day key.

When dealing with strings you tap once to select the whole thing (in case you want to delete or replace it), and you tap a second time if you want to bring up the qwerty keyboard and edit the string’s contents. We’re still working on making editing and replacing strings more intuitive.

–Frankie