staycia930
staycia930
MModular
Created by staycia930 on 7/2/2024 in #questions
I do not know why the output is like this!
I ran two almost identical programmes but the output changed. But I don't understand why the output changes. I would like to know. First Program
def greet(name: String):
name = "Hello, " + name + "!"
print(name)

fn main():
var name = "Mojo"
try:
greet(name)
except e:
print("Error: " , e)
def greet(name: String):
name = "Hello, " + name + "!"
print(name)

fn main():
var name = "Mojo"
try:
greet(name)
except e:
print("Error: " , e)
First output
Hello, Mojo!
Hello, Mojo!
Seccond Program
def greet(name):
name = "Hello, " + name + "!"
print(name)

fn main():
var name = "Mojo"
try:
greet(name)
except e:
print("Error: " , e)
def greet(name):
name = "Hello, " + name + "!"
print(name)

fn main():
var name = "Mojo"
try:
greet(name)
except e:
print("Error: " , e)
Seccond output
'Hello, Mojo!
'Hello, Mojo!
Using my environment ・MacOS ・Python3.12 ・Poetry ・mojo 24.4.0 (2cb57382)
3 replies