Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > Code Gallery
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #12  
Old 05-01-2009, 08:48 PM
Gambet Gambet is offline
Registered User
Join Date: Oct 2003
Posts: 2,712
Gambet is on a distinguished road
Quote:
Originally Posted by Tigairius View Post
That's correct, Java's switch() statements only allow ints, but that doesn't mean I should model my code after the standards Java runs. You may notice that GScript2 utilizes strings much differently than most coding languages. Following that logic I should also declare all of my variables before using them even though they're automatically declared when they're not equal to NULL.
Not true, Java's switch() does not only allow ints (it also allows char, byte, and short types), and for that matter, switch() works the same in just about every other popular language (such as C++ which was used largely in making Graal).

I'm not saying you shouldn't use strings in switch() statements on Graal, I'm just pointing out that other languages wouldn't allow you to do that. Regardless, though, I still feel that it was quite unnecessary in this case.


Quote:
Originally Posted by Tigairius View Post
It really isn't necessary for this... if someone said filteron and it was currently on it would just switch it off. An extra line or two really isn't a big deal in my opinion.
I agree that it isn't so important for this example, but when you're dealing with large scripts (such as the code for Windows that is well past millions of lines), it is quite important to shorten the number of lines as much as possible. Just a general tip.
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 01:39 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.