This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-09-12 16:27:57

Pawnfork
Scratcher
Registered: 2011-02-06
Posts: 14

Type

It seems like variables are very forgiving the way they treat you.  I have input numerical information and run both char and numerical functions against it at the same time.  Integer, real, floating point, it is equally happy.  Then I can take the same variable  and set it equal to an impressive bit of char*, at which point the numerical functions stop working, but in a friendly way that the function returns a dummy value like zero.

Whoa!  I'm used to things crashing around me if a call is not quite right, after struggling to find the right syntax.

Would it be right to assume that variables are primarily String, and numerical representation is a property, used if it applies?  Depth appears to exceed 64 bits!  The most forgiving thing I have ever seen.

Thanks

Offline

 

#2 2012-09-12 17:43:18

RedRocker227
Scratcher
Registered: 2011-10-26
Posts: 1000+

Re: Type

It was specifically built that way to be easier for beginners, so they don't have to worth about whether it's a string or a number


Why

Offline

 

#3 2012-09-12 17:55:10

bobbybee
Scratcher
Registered: 2009-10-18
Posts: 1000+

Re: Type

By default, variables are always strings. Stuff like the math blocks use an atoi type function (I'm guessing you're from a C/++ background).


I support the Free Software Foundation. Protect our digital rights!

Offline

 

Board footer