pro fib, nmax, char=char ;;; Check to see if keyword for characters is set. if keyword_set(char) then begin current = char last = '' endif else begin current = 1 last = 0 endelse ;;; print the first number print, current done = 0 ;we are not done while ~done do begin ;While not done, do some stuff ;;; Create next number in the sequence new = current + last ; plus sign is for addition for numbers, ; concatonation for strings ;;; Swap variables last = current current = new ;;; test again to see if keyword is set if keyword_set(char) then begin ;;; If the length of the string is less than Nmax then print ;;; else we are done if strlen(new) lt nmax then print, new else done = 1 endif else begin ;;; If the latest number is less than Nmax then print else we ;;; are done if new lt nmax then print, new else done = 1 endelse endwhile end