This is similar to most languages, when you use a if statement, all variables 
declared within are local to the if branch and are invalid outside of it.

If size is known at compile time you can use `when` instead which doesn't 
create a new scope:
    
    
    proc f(size: static int=1) =
        when size == 1:
            let
                widFrame = 320
                hiFrame = 200
        else:
            let
                widFrame = 3200
                hiFrame = 2000
        
        echo (widFrame, hiFrame)
    
    f()
    
    
    Run

Otherwise, use if-expression
    
    
    proc f(size=1) =
        let
           widFrame = if size == 1: 320
                      else: 3200
           hiFrame = if size == 1: 200
                     else: 2000
        
        echo (widFrame, hiFrame)
    
    f()
    
    
    Run

Note that I'm assuming this is a toy example, otherwise it might be better to 
pass a size + scaling factor.

Reply via email to