Synopsis: data_type variable_name = initial_value;
Variable declarations in YCP
are similar to C. Before you can use a
variable, you must declare it. With the declaration you appoint the
new variable to be of a certain data_type which
means you can assign only values of that specific type. To avoid any
errors caused by uninitialized variables, a declaration
must imply a suitable value assignment.
Note: A variable declaration may occur at several points in the code which determines its validity (accessibility) in certain program regions (see Section 8.15, “Variable Scopes and blocks”).
Example 8.2. Variable Declaration
{ integer int_num = 42; float float_num = 42.0; string TipOfTheDay = "Linux is the best!"; integer sum = 4 * (int_num + 8); }