Skip to content
Snippets Groups Projects
Commit fd2cda51 authored by Mark Wheelhouse's avatar Mark Wheelhouse
Browse files

added four new tests for string and char[] behaviour

parent c7135dab
No related branches found
No related tags found
No related merge requests found
# element access is not permitted for strings
# Output:
# #semantic_error#
# Exit:
# 200
# Program:
begin
string str = "hello world!" ;
println str ;
str[0] = 'H' ;
println str
end
# type mismatch: string <- char[]
# Output:
# #semantic_error#
# Exit:
# 200
# Program:
begin
string s = ['h','i','!'];
println s
end
# You cannot directly print a char[] in WACC
# Output:
# #syntax_error#
# Exit:
# 100
# Program:
begin
println ['H','e','l','l','o',' ','W','o','r','l','d','!']
end
# printing the contents of a char[] is possible via an intermediate variable
# Output:
# hi!
# Exit:
# 0
# Program:
begin
char[] s = ['h','i','!'];
println s
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment