Section not written yet...
In Data type any you have seen the data type any. Because the value of type any can not be assigned to a variable of any other type. FIXME. So it is importnat to check its type with is(...) and then re-assigning it to a variable of the correct type. The following example shows how this should be done.
Example 3.12. Type checking and data type any
// // Hypothetical example: // --------------------- // We don't know whether the SCR will return integers or floats... // any any_var = 0; integer int_var = 0; float float_var = 0.0; boolean int_case = false; any_var = SCR::Read(...); if ( is( any_var, integer ) ) { int_var = any_var; int_case = true; } else if ( is( any_var, float ) ) { float_var = any_var; int_case = false; } else { // Error... } if ( int_case ) { // Use int_var... } else { // Use float_var... } |
As this is very cumbersome, you should try to avoid this oddity in any case. If it is ineluctable, do it as shown above to stay compatible with future YaST behaviour.