TRIHAN'S PROFILE
Search
Filter
Slip into Ruby - Under the Hood part 3: Game Objects
They follow the same principle. You can do
just as easily as unless.
Ruby is one of the few languages that supports this syntax of putting your condition after the line of code to execute.
if $game_switches[#]
just as easily as unless.
Ruby is one of the few languages that supports this syntax of putting your condition after the line of code to execute.
Slip into Ruby - Under the Hood part 3: Game Objects
That's it! Though personally I'd just do
I try never to use explicit method calls for boolean checks if all I'm doing is checking for truth, implicit true for the win!
BattleManager.abort unless $game_switches[#]
I try never to use explicit method calls for boolean checks if all I'm doing is checking for truth, implicit true for the win!
Slip into Ruby - Under the Hood part 3: Game Objects
You'd use != for not equal to.
When you click the "code" tag it asks you what the language is. If you enter "ruby" it'll automatically colour the code for you.
When you click the "code" tag it asks you what the language is. If you enter "ruby" it'll automatically colour the code for you.
Slip into Ruby - Under the Hood part 3: Game Objects
No, if you wanted to do it non-implicitly you'd do
BattleManager.abort unless $game_switches[#] == true
McBacon Jam 4
author=Jeroen_Sol
Have we decided on a pronunciation yet? Is it Treyezyeohn Tehdjick?
Try-gerr-oh-enn Maj-ick.
Slip into Ruby - Under the Hood part 3: Game Objects
You can do just $game_switches[*] as a condition and it'll implicitly understand that you want to check it returns true for the value of the element, or if the switch class had a true? method defined you could do $game_switches[*].true?
Method calls will always have a dot between the name of the method and the object calling them.
Method calls will always have a dot between the name of the method and the object calling them.














