SuperCard 4.8 Direct Initialization of Local Variables

Need help with a script? This is the place to discuss how to get your code running!

SuperCard 4.8 Direct Initialization of Local Variables

Postby codegreen » Wed Mar 23, 2016 12:12 pm

To help further streamline your scripts, SuperCard 4.8 adds the ability to initialize local variables right in their declarations. In this respect the local declaration now more closely parallels enumeration.

Unlike enums though, there is (still) no implicit relationship between the values of successive locals in a declaration. For example:

Code: Select all
on mouseUp
  enum un, deux, trois
  local fullName = "Rufus T. Firefly", ¬
    firstName = word un of fullName, ¬
    middleName = word deux of fullName, ¬
    lastName = word trois of fullName, junkola
  answer "My name is" && firstName && middleName && lastName & "!" & cr & junkola
end mouseUp

Now you can combine all the 'busywork' of initializing multiple locals into one compact statement.

Posts: 1534
Joined: Mon Jul 14, 2008 11:03 pm

Return to Scripting in SuperTalk

Who is online

Users browsing this forum: No registered users and 1 guest