Discuss Scratch

Janinainfa
Scratcher
100+ posts

js or python

9gr wrote:

i use js
which one is better tho
I use both, although Python is better
misaPuding
Scratcher
1000+ posts

js or python

Maximouse wrote:

gosoccerboy5 wrote:

Rendangbike2 wrote:

print is much more understandable than console.log, I mean….. eurghhh.
console.log(“hi”) better than System.out.println(“hi”) or std::cout << “hi” at least
I don't think it's better than std::cout.
I think it is (because, well, think about what you would imagine if you don´tr know anything about C and JS. “Log ”hi“ into console” vs “cout ”hi“”)
wvj
Scratcher
1000+ posts

js or python

removed

Last edited by wvj (May 8, 2021 17:25:47)

Raihan142857
Scratcher
1000+ posts

js or python

misaPuding wrote:

Maximouse wrote:

gosoccerboy5 wrote:

Rendangbike2 wrote:

print is much more understandable than console.log, I mean….. eurghhh.
console.log(“hi”) better than System.out.println(“hi”) or std::cout << “hi” at least
I don't think it's better than std::cout.
I think it is (because, well, think about what you would imagine if you don´tr know anything about C and JS. “Log ”hi“ into console” vs “cout ”hi“”)
the point of programming isn't to be easy for beginners. imo python's simple syntax is what makes it so bad
misaPuding
Scratcher
1000+ posts

js or python

Greg8128 wrote:

gosoccerboy5 wrote:

Greg8128 wrote:

These languages didn't get in on the “statements as expressions” idea, and as a result JavaScript doesn't have it, either.
Please elaborate on the “statements as expressions” part, I don't quite understand
In most languages, statements (such as if/else and switch) are used to select which code to run. But in newer and cooler languages, they can be used to return a value. One such language is Scala:

In Scala, the if/else statement can be used as an expression, so a separate ternary operator is not needed.
val b = true
val i = if (b) 3 else 2
But there are also cooler applications. For example, the “match” expression is like a cooler version of the “switch” statement. Just like the if/else expression, it can be used to return a value.
val i = 2
val j = i match {
  case 1 => "one"
  case 2 => "two"
  case _ => "many"
}
This is pretty neat because it prevents you from needing to write “j = ” a bunch of times, and from needing to declare the variable j separately from assigning it.
Another thing you can do is use blocks as expressions:
val f = 3;
val i = {val j = 2; j * f + 3} // We only use j to calculate i
Think of it as a very simple closure that has no arguments and returns the last expression.

Overall, the point of being able to use statements as expressions is to be able to write in a more expressive style, with less boilerplate and a clearer relationship between the different calculations involved.
I don´t know Scala, what does “val” do?
Raihan142857
Scratcher
1000+ posts

js or python

misaPuding wrote:

Greg8128 wrote:

I don´t know Scala, what does “val” do?
It declares a variable.
AmazingMech2418
Scratcher
1000+ posts

js or python

Raihan142857 wrote:

misaPuding wrote:

Greg8128 wrote:

I don´t know Scala, what does “val” do?
It declares a variable.
Actually, a constant. var is for variables.
6d66yh
Scratcher
100+ posts

js or python

misaPuding wrote:

Maximouse wrote:

gosoccerboy5 wrote:

Rendangbike2 wrote:

print is much more understandable than console.log, I mean….. eurghhh.
console.log(“hi”) better than System.out.println(“hi”) or std::cout << “hi” at least
I don't think it's better than std::cout.
I think it is (because, well, think about what you would imagine if you don´tr know anything about C and JS. “Log ”hi“ into console” vs “cout ”hi“”)
I would rather it have no terminal/commandprompt environment whatsoever. It is overly abstractive, extremely high level and very awkward.
Steve0Greatness
Scratcher
1000+ posts

js or python

Front end or back end?
JS is best for front end things
Python would be best for the back end(better than php)
gdpr5b78aa4361827f5c2a08d700
Scratcher
1000+ posts

js or python

Steve0Greatness wrote:

Front end or back end?
JS is best for front end things
Python would be best for the back end(better than php)
NodeJS is generally regarded as very good for backend, probably better than Python. Here's how I would personally rate the 4 following backend languages (from best to worst):

C# (ASP.NET Core)
Node.js
Python
PHP
AmazingMech2418
Scratcher
1000+ posts

js or python

potatophant wrote:

Steve0Greatness wrote:

Front end or back end?
JS is best for front end things
Python would be best for the back end(better than php)
NodeJS is generally regarded as very good for backend, probably better than Python. Here's how I would personally rate the 4 following backend languages (from best to worst):

C# (ASP.NET Core)
Node.js
Python
PHP
How about Go? (honestly though, C# for ASP.NET would not be the best universally, although it might be your favorite, because it isn't cross-platform. XD) Also, Java is used some (a huge pain though. XD), and Ruby has Rails and Sinatra, and I'm pretty sure Dart is used quite often for backend web dev too… Also TypeScript with Deno is another one to look out for, and ASP.NET can be done with VB too.
gdpr5b78aa4361827f5c2a08d700
Scratcher
1000+ posts

js or python

AmazingMech2418 wrote:

potatophant wrote:

Steve0Greatness wrote:

Front end or back end?
JS is best for front end things
Python would be best for the back end(better than php)
NodeJS is generally regarded as very good for backend, probably better than Python. Here's how I would personally rate the 4 following backend languages (from best to worst):

C# (ASP.NET Core)
Node.js
Python
PHP
How about Go? (honestly though, C# for ASP.NET would not be the best universally, although it might be your favorite, because it isn't cross-platform. XD) Also, Java is used some (a huge pain though. XD), and Ruby has Rails and Sinatra, and I'm pretty sure Dart is used quite often for backend web dev too… Also TypeScript with Deno is another one to look out for, and ASP.NET can be done with VB too.
ASP.NET Core is cross platform, as well as being pretty fast and secure (primarily due to NuGet vs NPM), Ruby and Java I couldn't really categorise since I don't have that much experience, Dart I've never tried, and VB is probably not worth it since it'll soon be killed.
PkmnQ
Scratcher
1000+ posts

js or python

Raihan142857 wrote:

misaPuding wrote:

I think it is (because, well, think about what you would imagine if you don´tr know anything about C and JS. “Log ”hi“ into console” vs “cout ”hi“”)
the point of programming isn't to be easy for beginners. imo python's simple syntax is what makes it so bad
At least it's there to be the middle-sized snowball in the process of learning big compiled functional snowballs.

Last edited by PkmnQ (May 10, 2021 10:15:35)

gosoccerboy5
Scratcher
1000+ posts

js or python

mybearworld wrote:

gosoccerboy5 wrote:

[View post]

mybearworld wrote:

Lambda is a concept I just don't get in javascript
Yea, cause python lambda is limited to one line
That's the point. Why use lambda when it's the same thing as just using “normal” functions?
Because you can use lambda as a temporary variable that's only needed in the function, as a callback (granted other languages may avoid callback h*ll in the first place), a closure (not too sure what those are). In Python, lambda is super limited. Why would you want to be limited?
also, if bharvey saw this.. XD
(replying to https://scratch.mit.edu/discuss/post/5215729/)

then again, dart's lambda is superior above all, not even requiring the function keyword, or a clumsy =>

Last edited by gosoccerboy5 (May 10, 2021 15:11:13)

Sheep_maker
Scratcher
1000+ posts

js or python

gosoccerboy5 wrote:


then again, dart's lambda is superior above all, not even requiring the function keyword, or a clumsy =>
If we're comparing syntax, then I would say Kotlin has an even simpler lambda syntax
listOf(1, 2, 3, 4, 5).forEach {
    print(it)
}
 
val sum = { x: Int, y: Int -> x + y }
 
val product = items.fold(1) { acc, e -> acc * e }

Last edited by Sheep_maker (May 10, 2021 17:55:01)

adem1000
Scratcher
100+ posts

js or python

9gr wrote:

i use js
which one is better tho





if you ask me i will say both but if you have less time
i will say javascript but if you have more time i will say both
but i recommend java and C++(not javascript its “java” and javascritpt are different)
adem1000
Scratcher
100+ posts

js or python

adem1000 wrote:

9gr wrote:

i use js
which one is better tho





if you ask me i will say both but if you have less time
i will say javascript but if you have more time i will say both
but i recommend java and C++(not javascript its “java” and javascritpt are different)



because java and C++ are used to make , apps , websites , web apps and more
and also learn a database language cause it is need for sending and reciveing data
gdpr5b78aa4361827f5c2a08d700
Scratcher
1000+ posts

js or python

adem1000 wrote:

learn a database language cause it is need for sending and reciveing data
No it's not. Modern NoSQL databases such as MongoDB don't use their own dedicated language.
ajskateboarder
Scratcher
1000+ posts

js or python

First of all, are you talking about Node.JS or just plain JavaScript?

If you are actually debating this, then JavaScript would be better. The syntax is just more versatile and if there isn't something you can't do in JavaScript that is possible in any other language, you can call the program externally with ‘child-process’ and let the Python script return things.

Last edited by ajskateboarder (May 11, 2021 15:22:51)

Vaibhs11
Scratcher
1000+ posts

js or python

uwv wrote:

“python is just a console-based language”

Powered by DjangoBB