Cobra/Keywords/if: различия между версиями

Содержимое удалено Содержимое добавлено
Строка 40:
print 'x and y are the same'
</source></font>
 
# Example 1
print if(x>y, x, y)
 
# Example 2
print if(value, 'yes', 'no') # type is String
 
# Example 3
total += if(direction==DirectionEnum.Long, +1, -1) * amount
 
# Example 4
foo = if(condition, 'x', nil) # type is String?
 
# Example 5
foo = if(condition, 'x', 5) # type is Object