1/12
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
Can 'break' be used inside loops in PORTIA?
NO. 'break' is ONLY valid inside switch case blocks. Not supported in for, while, or do-while loops.
Can void functions have parameters?
NO. The PORTIA grammar forbids it. Use func int with return 0 as a workaround for logically void recursive functions.
Is 0.0 a valid double literal?
NO. PORTIA requires a minimum of 8 total digits. 0.0 has only 2. Minimum valid: 0.00000000. Enforced at RUNTIME, not by the lexer.
Can you declare local variables inside a switch case block?
NO. All variables must be declared at the top of the function body before the switch. You can only assign to pre-declared variables inside case blocks.
Can weave fields be arrays?
NO. Weave fields can only be primitive types. The CFG production <field_dec> => <dtype> id ; only allows primitives — no array declarations inside weaves.
Do you need 'using' to call another function?
NO. Functions are always callable without using. Only global variables and constants require explicit using binding.
Do weave types need 'using' to be referenced?
NO. Weave types are always visible inside functions without using.
Why does PORTIA require 'using' for global variables?
Explicitness. Prevents accidental global state modification. When you see "using counter", the dependency is visible in the code. Similar to import statements — no hidden side effects.
Framework: WHAT = explicit binding. WHY = no hidden global access.
EXAMPLE: using total;
const vs var — initialization rule?
var can use expressions (= 5 + 3). const must use literals only (= 100).
Both need using to access globals inside functions.
Maximum identifier length?
25 characters. States s231–s276 = valid. States s277–s280 = error states for a 26th character.
What escape sequences are valid in PORTIA?
\n (newline), \t (tab), " (double quote), ' (single quote). Valid in both string and char literals.
Char literal valid range?
Single printable ASCII — code points 32 to 126. Escape sequences \n \t " ' are also allowed.
Does PORTIA have a string length built-in?
Yes — len(str) returns the length as an int. It's a built-in function, not a method. abs, sqrt, and pow are the other three built-ins.