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

#1 2012-05-21 21:45:47

jsoares
New Scratcher
Registered: 2012-05-17
Posts: 5

Functions or Procedures...can they be done in Scratch?

I read something about "Blocks", but got confused.

I'm used to older programming languages that have functions or procedures that look something like this:

function playCard(westHand, tableHand,nbrCard)
  **this function is called each time West plays a card
possibly returns a value


What I'm doing now is repeating the same blocks of code over and over and just changing a parameter or two each time through. For example, I might change whose turn it is to play a card(west, north, east or south).

Is there something I'm missing that will allow you to code more efficiently?

Offline

 

#2 2012-05-21 22:17:46

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: Functions or Procedures...can they be done in Scratch?

Scratch currently doesn't support functions or procedures, but Scratch 2.0 will have procedures (when it is released).

The closest thing Scratch has is the "broadcast [] and wait" block in control, which will activate the code under the hat block "when I receive []", and then continue with the script below after it is done.


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

Board footer