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(v@P.x > 0){ | |
v@Cd = {1, 0, 0}; | |
} | |
else{ | |
v@Cd = {0, 1, 0}; | |
} | |
// Inline formatting: | |
// Curly brackets omitted. | |
if(v@P.x > 0) v@Cd = {1, 0, 0}; else v@Cd = {0, 1, 0}; | |
// Ternary formatting: | |
v@Cd = (v@P.x < 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