Nasal Conditionals: Difference between revisions

Jump to navigation Jump to search
m
Remove line numebrs
m (Use Nasal highlighter)
m (Remove line numebrs)
Line 250: Line 250:
Using this technique, you can reduce the complexity of huge conditional blocks. For example, consider this extract from weather_tile_management.nas:
Using this technique, you can reduce the complexity of huge conditional blocks. For example, consider this extract from weather_tile_management.nas:


<syntaxhighlight lang="nasal" line start="460">
<syntaxhighlight lang="nasal">
if (code == "altocumulus_sky"){weather_tiles.set_altocumulus_tile();}
if (code == "altocumulus_sky"){weather_tiles.set_altocumulus_tile();}
else if (code == "broken_layers") {weather_tiles.set_broken_layers_tile();}
else if (code == "broken_layers") {weather_tiles.set_broken_layers_tile();}

Navigation menu