RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
Braces vs. Brackets

0 Members and 1 Guest are viewing this topic.

*****
Rep:
Level 84
This text is way too personal.
Bronze - GIAW 11 (Hard)Silver - GIAW Halloween
Probably a dumb question but...

What's the difference between Braces {} and Brackets [] when scripting with RGSS2?

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Best Member2012 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
Well, braces create hashes and blocks. Square brackets create arrays. Since square brackets aren't really involved in blocks, I'm guessing what you are asking is what is the difference between a hash and array. There are quite a lot, but I'm guessing what you're interested in is that arrays can associate an object with an ID integer, whereas a hash can associate objects with any arbitrary objects, and there isn't any necessary order to it.

So, for instance, an array could be:
Code: [Select]
array = [5, "abc", 84]

and then array[0] would return 5, array[1] would return "abc", and array[2] would return 84.

Whereas a hash could be:

Code: [Select]
hash = { 1 => 5, "alpha" => "abc", :sym => 84 }

and then hash[1] would return 5, hash["alpha"] would return "abc", and hash[:sym] would return 84.

There are a number of reasons to use one or the other, if you want to know more.

*****
Rep:
Level 84
This text is way too personal.
Bronze - GIAW 11 (Hard)Silver - GIAW Halloween
Oh, that makes a bit more sense.

Thanks Modern.

********
Resource Artist
Rep:
Level 94
\\\\\
Project of the Month winner for June 2009
Yeah, he's awesome.

*****
Rep:
Level 84
This text is way too personal.
Bronze - GIAW 11 (Hard)Silver - GIAW Halloween