Created
February 4, 2021 19:43
-
-
Save morphingdesign/1a8ee6235fc14de353691d1a7fd121dd to your computer and use it in GitHub Desktop.
Variations in formatting simple inline if statements in Houdini Vex. Complex conditionals should utilize base formatting for clarity.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Base formatting: | |
// Curly brackets for encapsulating multiple statements. | |
if([email protected] > 0){ | |
v@Cd = {1, 0, 0}; | |
} | |
else{ | |
v@Cd = {0, 1, 0}; | |
} | |
// Inline formatting: | |
// Curly brackets omitted. | |
if([email protected] > 0) v@Cd = {1, 0, 0}; else v@Cd = {0, 1, 0}; | |
// Ternary formatting: | |
v@Cd = ([email protected] < 0) ? {1, 0, 0} : {0, 1, 0}; | |
// Reference: https://www.sidefx.com/docs/houdini/vex/statement.html#if |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment