Defining Variables
In OSL when you define a variable it will always be global scoped. This means the variable can be accessed from anywhere in your program including inside of defined functions.
variable = 10
Variables cannot be defined anywhere other than directly at the start of a line and using an equals sign.
If you attempt to access a variable that has not been defined yet, it will return the variable name as an untyped value.
log undefined_variable
// logs undefined_variable to the console with no quoteation marks.
Last updated
Was this helpful?