Difference between revisions of "User:Venator"

From Flexible Survival
Jump to: navigation, search
(Replaced content with "Hmm. Apparently previous example was wrong. That's what I get for going by forums.")
 
Line 1: Line 1:
Just a quick string parsing example. Note that this is a rather inefficient way of setting it up, but it catches all possibilities. It's quite possible to use nested if/otherwise/end ifs for shorter code with less redundancy, but for those new to string parsing this is safer.
+
Hmm. Apparently previous example was wrong. That's what I get for going by forums.
<pre>
 
[if [victor] is male and is not female]
 
  [if [loser] is male and is not female]Male on male VM[end if]
 
  [if [loser] is male and is female]Male on herm VM[end if]
 
  [if [loser] is female and is not male]Male on female VM[end if]
 
  [if [loser] is not male and is not female]Male on neuter VM[end if]
 
[end if]
 
[if [victor] is male and is female]
 
  [if [loser] is male and is not female]Herm on male VM[end if]
 
  [if [loser] is male and is female]Herm on herm VM[end if]
 
  [if [loser] is female and is not male]Herm on female VM[end if]
 
  [if [loser] is not male and is not female]Herm on neuter VM[end if]
 
[end if]
 
[if [victor] is female and is not male]
 
  [if [loser] is male and is not female]Female on male VM[end if]
 
  [if [loser] is male and is female]Female on herm VM[end if]
 
  [if [loser] is female and is not male]Female on female VM[end if]
 
  [if [loser] is not male and is not female]Female on neuter VM[end if]
 
[end if]
 
[if [victor] is not male and is not female]
 
  [if [loser] is male and is not female]Neuter on male VM[end if]
 
  [if [loser] is male and is female]Neuter on herm VM[end if]
 
  [if [loser] is female and is not male]Neuter on female VM[end if]
 
  [if [loser] is not male and is not female]Neuter on neuter VM[end if]
 
[end if]
 
</pre>
 

Latest revision as of 05:38, 24 November 2011

Hmm. Apparently previous example was wrong. That's what I get for going by forums.