Skip to content

Instantly share code, notes, and snippets.

@morphingdesign
Created February 4, 2021 19:43
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
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(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