आपका पहला Program
एक Lua program बस instructions की एक text file है जो print, calculate और decide करती है।
In this page:
आपका पहला Program
एक Lua script एक plain text file है, आमतौर पर .lua से खत्म होती है, ऊपर से नीचे तक चलती है। print function इसके arguments screen पर एक newline के साथ लिखता है। Strings quotes के बीच लिखी जाती हैं और .. operator से जोड़ी जाती हैं।
Note:
Scripts को .lua extension से save करें ताकि editors इन्हें recognise करें।
उदाहरण: Your first program
local name = "World"
print("Hello, " .. name .. "!")
print("2 + 3 =", 2 + 3)
-- Output:
-- Hello, World!
-- 2 + 3 = 5
Login to try C/C++/Java/PHP code in the editor
आम गलतियां
- कई arguments वाली एक call में print के बाद parentheses भूल जाना
- strings जोड़ने के लिए .. की बजाय + इस्तेमाल करना
- opening और closing quotes mismatch करना
चैप्टर सारांश
- एक script ऊपर से नीचे तक चलती है
- print एक newline add करता है
- Strings single या double quotes इस्तेमाल करती हैं
- .. strings जोड़ता है
🔒
Chapter Quiz — Complete all 7 topics to unlock
0/7 topics done
Complete these topics first: