Skip to content

Instantly share code, notes, and snippets.

@morphingdesign
Created February 4, 2021 19:43
Show Gist options
  • Save morphingdesign/1a8ee6235fc14de353691d1a7fd121dd to your computer and use it in GitHub Desktop.
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.
// 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