3 ms·
It would be nice to have some syntax hints. I dont know ruby so I dont know what the syntax for an if/else statement would look like even if it's obviously simp
by kooshball 15y ago
It would be nice to have some syntax hints. I dont know ruby so I dont know what the syntax for an if/else statement would look like even if it's obviously simple to someone that's seen it before.
- cubicle67 15y agoif warrior.feel.empty? warrior.walk! :forward else warrior.attack! end Edit: if you're new to ruby syntax, then it's probably worth pointing out that the ? and ! on the end of the method names has no special function (they're both valid characters for using in method names). By convention, methods that return a boolean end in ? and methods that modify the object end in !. For example, Array has two sort methods - sort and sort!. some_array.sort will return a sorted copy of some_array but leave the original unsorted. some_array.sort!, however, will sort aome_array