Discuss Scratch

Byron_Inc
Scratcher
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.
print (I love Scratch!)
A print function will be good when it comes to debugging. It will be in the control blocks, or a new extension called debugging.
print [] :: control stack
print line [] :: control stack // known as print ln in JS.
The print blocks can be used when you want to see if the part of the block is running. Example:
if <([sqrt v] of (5))=[2]> then
move (50) steps // it won't work
print [50 steps] :: control stack
else
move (20) steps
print [20 steps] :: control stack
end
Result:
20 steps
It can also be useful when you are checking your math, especially with complicated calculations.
Example:
set [a v] to (1)
set [b v] to (-8)
set [c v] to (15)
print ((((b) * (-1)) + ([sqrt v] of (((b) * (b)) - (((4) * (a)) * (c))))) / (2)) :: control stack
Result:
5
It can also print if a boolean is true.
print <((1)+(1)) = (2)> :: control stack
Result:
true
The print block will print thing in the same line. Example:
print [18] :: control stack
print [25] :: control stack
Result:
1825
But the print line block print them in different lines.
Example:
print line [18] :: control stack
print line [25] :: control stack
Result:
18
25
I hope you can accept this suggestion.

Last edited by Byron_Inc (July 31, 2020 10:38:18)

-Zyte-
Scratcher
1000+ posts

Add Print function

*whispers*print is Python, I'm pretty sure it's alert/prompt*whispers*
imaybewrong
Byron_Inc
Scratcher
1000+ posts

Add Print function

-Zyte- wrote:

*whispers*print is Python, I'm pretty sure it's alert/prompt*whispers*
imaybewrong
I think it's available in both coding languages.
fdreerf
Scratcher
1000+ posts

Add Print function

Workaround:
say []
or ::grey
set [ v] to []
or ::grey
add [] to [list v]
Byron_Inc
Scratcher
1000+ posts

Add Print function

fdreerf wrote:

Workaround:
say []
or ::grey
set [ v] to []
or ::grey
add [] to [list v]
Hmm… looks like a good workaround. I'm more to using a list.

EDIT: Yes, it worked.

Last edited by Byron_Inc (July 31, 2020 10:37:26)

Maximouse
Scratcher
1000+ posts

Add Print function

In JavaScript the function is called console.log, not print.
Byron_Inc
Scratcher
1000+ posts

Add Print function

Maximouse wrote:

In JavaScript the function is called console.log, not print.
Weird. That's what I learnt though.
Maximouse
Scratcher
1000+ posts

Add Print function

Byron_Inc wrote:

Maximouse wrote:

In JavaScript the function is called console.log, not print.
Weird. That's what I learnt though.
This means you probably learnt a non-standard version of JavaScript.
Byron_Inc
Scratcher
1000+ posts

Add Print function

Maximouse wrote:

Byron_Inc wrote:

Maximouse wrote:

In JavaScript the function is called console.log, not print.
Weird. That's what I learnt though.
This means you probably learnt a non-standard version of JavaScript.
ProcessingJS. In Khan Academy. Probably they modified the programming language.
Maximouse
Scratcher
1000+ posts

Add Print function

Byron_Inc wrote:

ProcessingJS. In Khan Academy. Probably they modified the programming language.
Then the function is a part of Processing, not JavaScript itself.
Byron_Inc
Scratcher
1000+ posts

Add Print function

Maximouse wrote:

Byron_Inc wrote:

ProcessingJS. In Khan Academy. Probably they modified the programming language.
Then the function is a part of Processing, not JavaScript itself.
Okay, thanks. But do you support the suggestion?
skymover1239
Scratcher
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
print(“Hello, world!”
secretagent123
Scratcher
1000+ posts

Add Print function

You can make text engines like this one.
Byron_Inc
Scratcher
1000+ posts

Add Print function

skymover1239 wrote:

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
print(“Hello, world!”
Printing at the console, probably a box showing below the stage.
Byron_Inc
Scratcher
1000+ posts

Add Print function

secretagent123 wrote:

You can make text engines like this one.
I'm not asking for a text engine. I'm asking for a “print” function that can output results in an extra box.
Byron_Inc
Scratcher
1000+ posts

Add Print function

BUMP
Maximouse
Scratcher
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.
Byron_Inc
Scratcher
1000+ posts

Add Print function

La bump
Boomer001
Scratcher
1000+ posts

Add Print function

deleted, the OP was edited

Last edited by Boomer001 (Aug. 1, 2020 10:35:46)

Maximouse
Scratcher
1000+ posts

Add Print function

Boomer001 wrote:

JavaScript ‘print’ prints the contents of the window using a printer.
I didn't even know that exists, but seems true.

Powered by DjangoBB