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
(Also, I like your username)
@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😁)
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!
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.
The first line starts with var month which means: create a new variable and call it month.
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(x), which — with the declaration
x = 'orange' — will print out a orange box, then a red box, then an amber box, etc.
@Elliot_Alderson — you can add the variables together. Like:
drawBoxes(x + x).
@Grasshopper_Heather but once I add x as variable to the function, the cursor goed to next line automatically.
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
This should answer your question:
If not, feel free to reply and I’ll try to go more in-depth.
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’;
var day = ‘Friday’;
Could anyone tell what could be happening?
Looks like y’all are having similar issues that should be answered by this:
Hope this helps! Feel free to reply if otherwise
The last line of code should be:
But whenever I tap the empty space in the bracket, a quotation marks shows up which I can’t remove it:
So I’m stuck at:
Is it a bug?
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
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.