Learn advanced Mewar features including Constants, Enums, Records, Pointers, Type Casting and Bitwise Operations.
const kingdom to "Mewar" say kingdom set kingdom to "karan" say kingdom
enum Color then RED GREEN BLUE end say Color.RED say Color.GREEN say Color.BLUE
record Warrior then name power alive end set w to Warrior set w.name to "Pratap" set w.power to 100 set w.alive to true say w.name say w.power
record Warrior then name power alive end set x to Warrior set x.name to "karan" set x.power to 200 set x.alive to "yes" say x.name say x.power say x.alive
# 1️⃣ BASIC VARIABLE set x to 10 say "Initial x = " + x # 2️⃣ CREATE POINTER set p to address x say "Pointer p created to x"
# 1️⃣ BASIC VARIABLE set x to 10 say "Initial x = " + x # 2️⃣ CREATE POINTER set p to address x say "Pointer p created to x" # 3️⃣ READ THROUGH POINTER say "Value via pointer p = " + value p newline # 4️⃣ MODIFY VIA POINTER set value p to 50 say "After pointer write, x = " + x newline # 5️⃣ SECOND VARIABLE set y to 100 say "Initial y = " + y # 6️⃣ POINT POINTER TO ANOTHER VARIABLE set p2 to address y say "Pointer p2 created to y" say "Value via pointer p2 = " + value p2 newline # 7️⃣ POINTER WRITE WITH VARIABLE set value p2 to x say "After p2 write, y = " + y newline # 8️⃣ POINTER CHAIN (POINTER TO POINTER VALUE) set z to 999 set p3 to address z say "z = " + z say "value p3 = " + value p3 set value p3 to value p say "After chaining, z = " + z newline # 9️⃣ SHOW POINTER DETAILS say "----- SHOW POINTER STATES -----" show x show y show z show p show p2 show p3 newline # 🔟 POINTER SAFETY TEST say "----- INVALID POINTER TEST -----" set fake to 5 test set value fake to 100 fail err then say "Pointer error handled: " + err end newline # 1️⃣1️⃣ POINTER + FUNCTION function set_to_200 with ptr then set value ptr to 200 end call set_to_200 with p say "After function pointer write, x = " + x
# BASIC VARIABLE set x to 10 say "Initial x = " + x # CREATE POINTER set p to address x say "Pointer p created to x" # MODIFY VIA POINTER set value p to 50 say "After pointer write, x = " + x
set text to "50" set num to number(text) say num
set value to 100 set text to string(value) say text show text
set gold to 10 gold++ say gold
set gold to 10 gold-- say gold
set gold to 100 gold += 50 say gold
set result to 5 & 3 say result
set result to 5 | 3 say result
set result to 5 ^ 3 say result
set result to 5 << 1 say result
set result to 8 >> 1 say result
const kingdom to "Mewar" set gold to 100 gold += 50 say gold