Discuss Scratch
- Byron_Inc
-
1000+ posts
Add Print function
Note: The word “print” here means showing a box with the result, as if it's in JS. It doesn't mean print it on paper.
A print function will be good when it comes to debugging. It will be in the control blocks, or a new extension called debugging.
It can also be useful when you are checking your math, especially with complicated calculations.
Example:
It can also print if a boolean is true.
The print block will print thing in the same line. Example:
But the print line block print them in different lines.
Example:
I hope you can accept this suggestion. 
print (I love Scratch!)
print [] :: control stackThe print blocks can be used when you want to see if the part of the block is running. Example:
print line [] :: control stack // known as print ln in JS.
if <([sqrt v] of (5))=[2]> thenResult:
move (50) steps // it won't work
print [50 steps] :: control stack
else
move (20) steps
print [20 steps] :: control stack
end
20 steps
Example:
set [a v] to (1)Result:
set [b v] to (-8)
set [c v] to (15)
print ((((b) * (-1)) + ([sqrt v] of (((b) * (b)) - (((4) * (a)) * (c))))) / (2)) :: control stack
5
print <((1)+(1)) = (2)> :: control stackResult:
true
print [18] :: control stackResult:
print [25] :: control stack
1825
Example:
print line [18] :: control stackResult:
print line [25] :: control stack
18
25

Last edited by Byron_Inc (July 31, 2020 10:38:18)
- -Zyte-
-
1000+ posts
Add Print function
*whispers*print is Python, I'm pretty sure it's alert/prompt*whispers*
imaybewrong
imaybewrong
- Byron_Inc
-
1000+ posts
Add Print function
I think it's available in both coding languages. *whispers*print is Python, I'm pretty sure it's alert/prompt*whispers*
imaybewrong
- fdreerf
-
1000+ posts
Add Print function
Workaround:
say []
or ::grey
set [ v] to []
or ::grey
add [] to [list v]
- Byron_Inc
-
1000+ posts
Add Print function
Hmm… looks like a good workaround. I'm more to using a list. Workaround:say []
or ::grey
set [ v] to []
or ::grey
add [] to [list v]
EDIT: Yes, it worked.
Last edited by Byron_Inc (July 31, 2020 10:37:26)
- Maximouse
-
1000+ posts
Add Print function
In JavaScript the function is called console.log, not print.
- Byron_Inc
-
1000+ posts
Add Print function
Weird. That's what I learnt though. In JavaScript the function is called console.log, not print.
- Maximouse
-
1000+ posts
Add Print function
This means you probably learnt a non-standard version of JavaScript.Weird. That's what I learnt though. In JavaScript the function is called console.log, not print.
- Byron_Inc
-
1000+ posts
Add Print function
ProcessingJS. In Khan Academy. Probably they modified the programming language.This means you probably learnt a non-standard version of JavaScript.Weird. That's what I learnt though. In JavaScript the function is called console.log, not print.
- Maximouse
-
1000+ posts
Add Print function
Then the function is a part of Processing, not JavaScript itself. ProcessingJS. In Khan Academy. Probably they modified the programming language.
- Byron_Inc
-
1000+ posts
Add Print function
Okay, thanks. But do you support the suggestion?Then the function is a part of Processing, not JavaScript itself. ProcessingJS. In Khan Academy. Probably they modified the programming language.
- skymover1239
-
500+ posts
Add Print function
Support, although I have a question would this be like making text appear across the screen, or
would it be printing a line of text in a console like
would it be printing a line of text in a console like
print(“Hello, world!”
- Byron_Inc
-
1000+ posts
Add Print function
Printing at the console, probably a box showing below the stage. Support, although I have a question would this be like making text appear across the screen, or
would it be printing a line of text in a console likeprint(“Hello, world!”
- Maximouse
-
1000+ posts
Add Print function
Interesting idea, but it would make more sense to be called “debug” because it would only be used for debugging. Also, you could just use a list.
- Boomer001
-
1000+ posts
Add Print function
deleted, the OP was edited
Last edited by Boomer001 (Aug. 1, 2020 10:35:46)
- Maximouse
-
1000+ posts
Add Print function
I didn't even know that exists, but JavaScript ‘print’ prints the contents of the window using a printer.seems true.