Jump to content

Bot

Members
  • Posts

    47
  • Joined

  • Last visited

  • Feedback

    0%

Posts posted by Bot

  1. I like this piece but it's kind of low quality. If you look around the areas where the light fades into darkness, the quality just drops but overall this is a pretty nice piece. 

    • Like 1
  2. The reasoning behind it I think is performance. HTML5 is a pretty recent language like Bythex said and it brings a lot of great web features to the table. RuneScape is a web based game and it makes sense to use a more web orientated platform. 

  3. (This is my second time typing this entire thread)

     

    The Switch Statement

     

    Part of this knowledge comes from: http://docs.oracle.com/javase/tutorial/java/nutsandbolts/switch.html

    The switch statement is a cleaner, faster way to show multiple if else statements. In a switch block, a  Character, Byte, Short, Integer, String or Enum can be used. Here is an example using String 

    switch(myString) {    case "A":    break;    case "B":    break;}

    Enums use the Enum constants when switching. For example:

    switch(myEnum){     case MEnum.Foo;    break;    case MEnum.ooF;    break;}

     

    Note that the only time the cases are enclosed within quotation marks( " ) is when we are using a String. Also notice the fact that we use a break after every case. This is to prevent falling through to the next case. For example 

    switch(myString) {    case "A":    case "B":     break;}

     

    In the case of A, not only will everything under the case of A be executed, but so will everything following that unless it is broken with a break

     

     

    Extra Information from thiefmn6092:



    once the number of conditions goes over a certain threshold (3 i believe with oracles jvm), a switch statement will be evaluated as a http://en.wikipedia.org/wiki/Branch_table. there are also other conditions that determine whether this is used. this allows the jvm to optimize more selectively for that block of code as well.

    The Ternary Operator

     

    You can consult: http://alvinalexander.com/java/edu/pj/pj010018 if you find this unclear. However, if you do please let me know. 

     

    The ternary is another way of replacing an if else statement that might look like

    if(myInt == 2) {   someInt = 5;}

     

    In a ternary, this would look like 

    someInt = myInt == 2 ? 5 : someInt;

     

    Here's a breakdown of what just happened. The structure of a basic ternary is 

    field = (Condition) ? (Action) : (Default Action/What happens if the condition is failed)

     

    The condition is any condition that you would normally meet in an if statement. If you have an if statement like this 

    if(myInt == 2 || myInt == 4 || myInt == 6) {   someInt = 5;}

     

    Then the ternary would look like 

    someInt = myInt == 2 || myInt == 4 || myInt == 6 ? 5 : someInt;

     

    You can also stack multiple ternaries into one statement so where the default action would be we can say 

    someInt = myInt == 2 || myInt == 4 || myInt == 6 ? 5 : myInt == 8 ? 10 : -1;

     

    That is the same as saying
     

    if(myInt == 2 || myInt == 4 || myInt == 6) {   someInt = 5;} else if(myInt == 8) {   someInt = 10;} else {   someInt = -1;}

     

    The ternary just puts it into one neat little line. Of course you can apply your java syntax knowledge and use brackets.

     

    Let me know if I missed anything, this is my second attempt so I'm kind of worn. 

  4. Paypal is pretty much a standard medium around. I support PaySafeCard like Djordy/Raflesia suggested. I don't like PayPal at all. 

×
×
  • Create New...