[S] worked on nim. added changes to NIM docs.
This commit is contained in:
@@ -20,12 +20,14 @@ proc MessageBox*(hWnd: HWND, lpText: LPCSTR, lpCaption: LPCSTR, uType: UINT): in
|
||||
|
||||
var
|
||||
titlemessages = @["Are you really free?",
|
||||
"Window on the street, only mesmerized and pondering... Am I in the right?"]
|
||||
captionmessages = @["From the river to the sea, Palestine will be free.",
|
||||
"I believe and have faith in you."]
|
||||
|
||||
"Poland!"]
|
||||
captionmessages = @["From the river to the sea, Palestine will be free.", "We are the people of Heaven.",
|
||||
"War is peace. Slavery is freedom. Ignorance is strength.","Kurva mac!"] # todo: convert to cstrings
|
||||
randomize() # seeds randomizer
|
||||
var
|
||||
randomtitle:string = sample(titlemessages)
|
||||
randommessage:string = sample(captionmessages)
|
||||
|
||||
var
|
||||
randomtitle:cstring = sample(titlemessages).cstring
|
||||
randommessage:cstring = sample(captionmessages).cstring
|
||||
|
||||
if isMainModule:
|
||||
MessageBox(0, randomtitle, randommessage, 0)
|
||||
|
||||
@@ -4,8 +4,9 @@ proc fileExists(filename: cstring): bool =
|
||||
result = GetFileAttributesA(filename) != INVALID_FILE_ATTRIBUTES
|
||||
|
||||
const
|
||||
filename = "C:\\path\\to\\your\\file.txt"
|
||||
filename = "C:\\path\\to\\your\\file.txt" # double-\ because it's an escape character.
|
||||
if fileExists(filename):
|
||||
echo "The file exists!"
|
||||
echo "File exists."
|
||||
else:
|
||||
echo "The file does not exist."
|
||||
echo "File does not exist."
|
||||
|
||||
Reference in New Issue
Block a user