Merge branch 'devel' of github.com:nim-lang/Nim into devel
This commit is contained in:
commit
0c33244c23
2 changed files with 9 additions and 5 deletions
|
|
@ -208,7 +208,8 @@ Note that declaring multiple variables with a single assignment which calls a
|
||||||
procedure can have unexpected results: the compiler will *unroll* the
|
procedure can have unexpected results: the compiler will *unroll* the
|
||||||
assignments and end up calling the procedure several times. If the result of
|
assignments and end up calling the procedure several times. If the result of
|
||||||
the procedure depends on side effects, your variables may end up having
|
the procedure depends on side effects, your variables may end up having
|
||||||
different values! For safety use only constant values.
|
different values! For safety use side-effect free procedures if making multiple
|
||||||
|
assignments.
|
||||||
|
|
||||||
|
|
||||||
Constants
|
Constants
|
||||||
|
|
@ -642,7 +643,7 @@ initialisation.
|
||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
----------
|
----------
|
||||||
Parameters are constant in the procedure body. By default, their value cannot be
|
Parameters are immutable in the procedure body. By default, their value cannot be
|
||||||
changed because this allows the compiler to implement parameter passing in the
|
changed because this allows the compiler to implement parameter passing in the
|
||||||
most efficient way. If a mutable variable is needed inside the procedure, it has
|
most efficient way. If a mutable variable is needed inside the procedure, it has
|
||||||
to be declared with ``var`` in the procedure body. Shadowing the parameter name
|
to be declared with ``var`` in the procedure body. Shadowing the parameter name
|
||||||
|
|
|
||||||
|
|
@ -467,16 +467,18 @@ proc resetAttributes*(f: File) =
|
||||||
f.write(ansiResetCode)
|
f.write(ansiResetCode)
|
||||||
|
|
||||||
type
|
type
|
||||||
Style* = enum ## different styles for text output
|
Style* = enum ## different styles for text output
|
||||||
styleBright = 1, ## bright text
|
styleBright = 1, ## bright text
|
||||||
styleDim, ## dim text
|
styleDim, ## dim text
|
||||||
styleUnknown, ## unknown
|
styleItalic, ## italic (or reverse on terminals not supporting)
|
||||||
styleUnderscore = 4, ## underscored text
|
styleUnderscore = 4, ## underscored text
|
||||||
styleBlink, ## blinking/bold text
|
styleBlink, ## blinking/bold text
|
||||||
styleReverse = 7, ## unknown
|
styleReverse = 7, ## reverse
|
||||||
styleHidden ## hidden text
|
styleHidden ## hidden text
|
||||||
|
styleStrikethrough, ## strikethrough
|
||||||
|
|
||||||
{.deprecated: [TStyle: Style].}
|
{.deprecated: [TStyle: Style].}
|
||||||
|
{.deprecated: [styleUnknown: styleItalic].}
|
||||||
|
|
||||||
when not defined(windows):
|
when not defined(windows):
|
||||||
var
|
var
|
||||||
|
|
@ -843,6 +845,7 @@ when not defined(testing) and isMainModule:
|
||||||
write(stdout, "never mind")
|
write(stdout, "never mind")
|
||||||
stdout.eraseLine()
|
stdout.eraseLine()
|
||||||
stdout.styledWriteLine("styled text ", {styleBright, styleBlink, styleUnderscore})
|
stdout.styledWriteLine("styled text ", {styleBright, styleBlink, styleUnderscore})
|
||||||
|
stdout.styledWriteLine("italic text ", {styleItalic})
|
||||||
stdout.setBackGroundColor(bgCyan, true)
|
stdout.setBackGroundColor(bgCyan, true)
|
||||||
stdout.setForeGroundColor(fgBlue)
|
stdout.setForeGroundColor(fgBlue)
|
||||||
stdout.writeLine("ordinary text")
|
stdout.writeLine("ordinary text")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue